-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Nulls.AS_EMPTY
returns null in java.lang.Object
#3489
Comments
I've added the empty value to the Object deserializer in maps as `new Object();`.
I am not sure how this can really work unfortunately as there is no obvious "empty" representation of "untyped" value (nominal type of But... maybe it should be configurable? I could see that working. It would have to be a per-mapping configuration feature, and there'd be lots of wiring. But configurable choice of "empty" value for |
Thanks, @cowtowncoder for your insights! What do you think about implementing it like this:
Why I didn't use the same approach that exists for At this point I think that I need to negotiate the API first, then let's think about implementation :) |
Hmmh. Not sure about call flow, use of But then again, adding all the logic to pipe in Yet Another Provider might be daunting. |
Describe the bug
When I'm using
JsonSetter.Value.forValueNulls(Nulls.AS_EMPTY, Nulls.AS_EMPTY)
for nullable value with typejava.lang.Object
in a Map, I still getting the null in the deserialized object. I think that problem is thatcom.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.Vanilla
doesn't overridecom.fasterxml.jackson.databind.JsonDeserializer#getEmptyValue(com.fasterxml.jackson.databind.DeserializationContext)
. I think that the deserializer for object should return empty object in thegetEmptyValue
method.Version information
2.13.2.2
To Reproduce
If you have a way to reproduce this with:
ObjectMapper
and override nullable behavior:a
object we got anull
in thethird
key:Expected behavior
I'm expecting that the empty value of the
java.lang.Object
is a new Object instance.The text was updated successfully, but these errors were encountered: