json ignore field on Marshal only

375 views
Skip to first unread message

bolang

unread,
Jun 23, 2014, 5:08:59 AM6/23/14
to golan...@googlegroups.com
Hi all,

I know i can ignore a field with `json:"-"`.
But it will ignore in both Marshal and Unmarshal.

How to ignore the field on Marshal only?

Thanks

C Banning

unread,
Jun 23, 2014, 7:00:33 AM6/23/14
to golan...@googlegroups.com
Message has been deleted

Klaus Post

unread,
Jun 23, 2014, 9:49:59 AM6/23/14
to golan...@googlegroups.com
Here is C Bannings example without "unsafe", using an anonymous field to hide content from Marshal:


/Klaus

Glen Newton

unread,
Jun 24, 2014, 10:38:36 AM6/24/14
to golan...@googlegroups.com
It would be nice to be able to (safely and easily) alter these sort of annotations at runtime, like my discussion in https://groups.google.com/forum/#!searchin/golang-nuts/glen.newton/golang-nuts/56vJQuEIrqY/KOYngG2PRlEJ

-Glen
Reply all
Reply to author
Forward
0 new messages