Richard Bucker

GOLANG Encoding not always ideal

Posted at — Apr 5, 2013

When using GOLANG’s encoding for JSON and the datatype is Time. “omitempty” does not work. It always emits the default value ‘0001-01-01 00:00:00 +0000 UTC’. This is not working as expected.type Stuff struct {  Cloned       time.Time   json:"cloned</span><span style="font-family: 'Courier New', Courier, monospace;">,omitempty</span><span style="font-family: 'Courier New', Courier, monospace;">"  Expiration   time.Time   json:"expiration,omitempty"}