-
Notifications
You must be signed in to change notification settings - Fork 39
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
Deserialization from null to JsonValue #181
Comments
hi @leadpony, thanks for raising this issue on the spec. I agree it does make sense. My only concern would be backwards compatibility. However, I'm not sure if we'll be doing a 2.0 or a 1.1 release next so it might be OK. |
Technically you can assign |
Java allows for developers to assign |
In jsonb, jsonvalue should be a fallback when nothing matches - otherwise you use a deserializer (from jsonb if local) if you need json metadata and not only binding. So we shouldnt encourage it. Now, the original json really has jsonvalue.null so it must be injected as such for jsonvalue type. However, an empty json would bind java null and not any jsonvalue instance to respect the binding. Does it sound ok? |
Yes. |
After some thinking I am fine to add to 2.0 spec feature set. |
According to the current spec, mapping JSON document
to the following Java class
assigns
null
to thevalue
in the class instead ofJsonValue.NULL
.On the other hand, the following JSON document
assigns a JSON object to the
value
andJsonValue.NULL
is assigned to itsvalue2
property.I believe
null
in JSON should be converted toJsonValue.NULL
if the target type isJsonValue
, in the same way it is converted specially toOptional.empty()
when the target type isOptional
.Please see also eclipse-ee4j/yasson#293
The text was updated successfully, but these errors were encountered: