json icon indicating copy to clipboard operation
json copied to clipboard

Does not work with dates

Open palsivertsen opened this issue 4 years ago • 0 comments

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.

palsivertsen avatar Apr 20 '21 15:04 palsivertsen