Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
json ignore field on Marshal only
375 views
Skip to first unread message
bolang
unread,
Jun 23, 2014, 5:08:59 AM
6/23/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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 AM
6/23/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
http://play.golang.org/p/kABz76U1kq
Message has been deleted
Klaus Post
unread,
Jun 23, 2014, 9:49:59 AM
6/23/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Here is C Bannings example without "unsafe", using an anonymous field to hide content from Marshal:
http://play.golang.org/p/-oZVK-2S_9
/Klaus
Glen Newton
unread,
Jun 24, 2014, 10:38:36 AM
6/24/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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