gurudk / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Feature request: Force inclusion of specific field when null #532

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Gson allows blanket-inclusion of null fields, using serializeNulls().  But this 
produces much bigger JSON output (which is why the default is not to serialize 
nulls).

It would be nice to support a per-field annotation, for just those fields where 
(broken) clients expect a null to be provided.  The alternative is to turn on 
serializeNulls everywhere (I think).

Jackson supports this with @JsonInclude(Include.ALWAYS).

Original issue reported on code.google.com by jus...@fathomdb.com on 26 Aug 2013 at 12:58