json
json copied to clipboard
Does not work with dates
See this playground example.
Docs says:
- Support zero values of structs with omitempty: golang/go#11939.
If omitempty is applied to a struct and all the children of the struct are empty, then on marshalling it will be omitted from the encoded json.
Using omitempty on a time.Time field makes Marshal function always ignore the field.
I suspect this is because time.Time has no exported children and relies on the MarshalJSON function for serialization.