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
You need to use omitzero, not omitempty. The way it works:
omitempty – Don't write if the value is "empty": len(0) for arrays, slices, maps, strings, false for bools
omitzero – Don't write if the value is zero, only works for numbers.
It's annoying that it works like this, but there isn't any way to change this to the more standard behaviour without breaking comparability. It's one of the things that will be fixed in a hypothetical unplanned v2 release. See: #120.
Related to #221
For tag version v0.3.1
the output is
It seems that, the
omitempty
not working on int and float.The text was updated successfully, but these errors were encountered: