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
Consider any struct type A with a field F tagged as omitempty, where F has type B.
If B has a custom MarshalJSON implementation with a pointer receiver, for values of A where F has an empty value the empty value of F is not omitted as it should.
This seems similar to #458, but tried its fix for this and it did not work.
Example
Consider the type stringAlias with a custom MarshalJSON implementation with a pointer receiver:
Description
Consider any struct type
A
with a fieldF
tagged asomitempty
, whereF
has typeB
.If
B
has a customMarshalJSON
implementation with a pointer receiver, for values ofA
whereF
has an empty value the empty value ofF
is not omitted as it should.This seems similar to #458, but tried its fix for this and it did not work.
Example
Consider the type
stringAlias
with a customMarshalJSON
implementation with a pointer receiver:Now consider type
withOmit
, which has a fieldA
tagged asomitempty
, having typestringAlias
:For values of
withOmit
with empty values of A,go-json
fails to omit values of this field:Full code example available at https://go.dev/play/p/4njSDtWS8k5 (couldn't make it run though, it times out when downloading dependencies).
The text was updated successfully, but these errors were encountered: