You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See also #11939 and #45669, and tangentially #22480. This is working as currently documented:
The "omitempty" option specifies that the field should be omitted from the encoding if the field has an empty value, defined as false, 0, a nil pointer, a nil interface value, and any empty array, slice, map, or string.
With respect to omitempty, there is no "empty" value of any struct type.
What version of Go are you using (
go version
)?What did you do?
Marshal a struct into Json with omitempty.
https://go.dev/play/p/nTyS0p_JP3E
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: