Skip to content

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

Closed
@cowtowncoder

Description

@cowtowncoder

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xIssues to be only tackled for Jackson 3.x, not 2.x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions