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
It's typical to use JSON as a minimal/lightweight serialization format. Usually, for the sake of brevity, a good signal/noise ratio, and sematic correctness, properties which don't have a value are omitted rather than present with a null value.
e.g.
{ "id" : "5652963" }
is preferred over
{ "id" : "5652963", "name" : null }
By default, Jackson includes null valued properties in serialized output but this can easily be changed using @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL).
I believe this annotation should be used by default, my guess is that most JSON users prefer the lighter/cleaner format. If required, I'll add a parameter to allow this to be removed though, for those that want to see the nulls.
Original author: [email protected] (June 09, 2011 20:58:16)
It's typical to use JSON as a minimal/lightweight serialization format. Usually, for the sake of brevity, a good signal/noise ratio, and sematic correctness, properties which don't have a value are omitted rather than present with a null value.
e.g.
{ "id" : "5652963" }
is preferred over
{ "id" : "5652963", "name" : null }
By default, Jackson includes null valued properties in serialized output but this can easily be changed using @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL).
I believe this annotation should be used by default, my guess is that most JSON users prefer the lighter/cleaner format. If required, I'll add a parameter to allow this to be removed though, for those that want to see the nulls.
Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=29
The text was updated successfully, but these errors were encountered: