Skip to content
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

Change Optional deserialization from "absent" value into null, from "empty" #3601

Closed
cowtowncoder opened this issue Sep 22, 2022 · 0 comments
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x

Comments

@cowtowncoder
Copy link
Member

(note: see FasterXML/jackson-modules-java8#251 for background with Jackson 2.x)

So, other "reference type" deserializers handle things so that:

  1. explicit null token becomes "empty" reference (like new AtomicReference<>(null) or Optional.empty())
  2. absent (missing) value becomes Java null

but currently for Optional (2) is not true: instead, it behaves same as explicit null value from JSON.
This is problematic as it is not possible to distinguish "absent" case from explicit null.

We can change behavior for Jackson 3.0.

@cowtowncoder cowtowncoder added to-evaluate Issue that has been received but not yet evaluated 3.x Issues to be only tackled for Jackson 3.x, not 2.x and removed to-evaluate Issue that has been received but not yet evaluated labels Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x
Projects
None yet
Development

No branches or pull requests

1 participant