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
When a json object contains an explicit null for a field, the custom
deserializer for that field type is never called, rather the field is
simply set to null. This makes it impossible to map json nulls to some
non-null value in a consistent way. It also makes it impossible to have
guaranteed non-null fields in objects which are deserialized from json.
The handling of explicit nulls and missing values is also inconsistent: in
the case of an explicit null, the Java object's field is set to null. In
the case of a missing value, the field is left alone (as initialized by the
no-arg constructor).
The behavior for missing values is reasonable, but the behavior for
explicit nulls is very difficult to work around. Explicit null values
should (perhaps optionally) be passed through the custom deserializer.
What steps will reproduce the problem?
1. compile the attached file
2. run it
What is the expected output? What do you see instead?
Expected output:
NullInner should equal NullInner
NullInner should equal NullInner
OR:
NullInner should equal NullInner
InitInner should equal NullInner
I see:
null should equal NullInner
InitInner should equal NullInner
What version of the product are you using? On what operating system?
gson 1.4
Original issue reported on code.google.com by [email protected] on 3 Nov 2009 at 11:33
Original issue reported on code.google.com by
[email protected]
on 3 Nov 2009 at 11:33Attachments:
The text was updated successfully, but these errors were encountered: