-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for reading null
fields when reading simple objects
#73
Comments
Just to make sure I understand: if POJO was like public class Bean {
public Date date;
} and JSON { "date" : null } then I think it absolutely should work so that It this the problem you have? |
I can reproduce the problem as described. |
Fixed this specific problem for 2.10.5/2.11.2 (as well as related scalar types I saw). |
Thank you, looking ahead for those versions to be released. |
Let's say I use
JSON.std.beanFrom(MyBean.class, INPUT)
as stated in the docs andMyBean
has aDate
field. If the JSON being parsed has a numeric value for that data field, then everything works ok, but if the value isnull
(for example"birthday":null
), then I end up with:com.fasterxml.jackson.jr.ob.JSONObjectException: Can not get long numeric value from JSON (to construct java.util.Date) from 'null'
.This seems to be an arbitrary limitation caused by
SimpleValueReader.read
having following block:Any reason to not improve on this, to return an actual
null
value instead of throwing an exception? Conceptually at least, seam the right thing to do, especially since reading into aMap
(as opposed to POJO) works like that.The text was updated successfully, but these errors were encountered: