encoding/json: support omitempty and omitzero at API level #72972
Labels
FeatureRequest
Issues asking for a new feature that does not need a proposal.
LibraryProposal
Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Currently json marshalling and unmarshalling supports omitting empty or zero fields by tagging the fields in their struct.
However, we have cases when we don't control the struct, or when we have an opaque
map[string]any
to marshal.It would be useful to be able to do
json.Marshal(data, json.OmitEmptyOption, json.OmitZeroOption)
The text was updated successfully, but these errors were encountered: