Closed JohnRusk closed 9 months ago
I think this is out-of-scope for the current project. Feel free propose something over at github.com/golang/go. The set of additional features provided by this module are all based on the most popular feature requests on the main issue tracker: https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+encoding%2Fjson+in%3Atitle+sort%3Areactions-%2B1-desc+
Hi,
Occasionally, it's desirable to get a json representation of an object that includes all fields - even those marked with omitempty and which are currently empty. An example would be if you're providing the output to a human reader to show them the structure of the object. In that case, it's nice to include all fields even those that are currently empty.
So, it would be nice if this library included a setting such as
emitUnpopulated
inMarshalOptions
. When true, theomitempty
tag would be ignored.Protojson alread has a similar setting.