--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Denis, in your playground link you don’t make the attribute T
exposed. The attribute must be exposed for the field to ever be marshaled into JSON. Also, omitempty
must be used after a comma to denote that it’s a property, not the name of the field.
Here’s an updated example: http://play.golang.org/p/Jour5HAKEe
Your best bet seems to be making the T
attribute a pointer, it will be nil
when uninstantiated.
http://play.golang.org/p/ud6OLZUrmY
and then try to serialize it, I get "t":"0001-01-01T00:00:00Z" instead of "t" being absent.