Skip to content

Add DeserializationFeature.USE_NULL_FOR_MISSING_REFERENCE_VALUES for selecting null vs "empty/absent" value when deserializing missing Optional value #5350

Closed

Description

@cowtowncoder

(note: follow-up to #3601, #5335)

As of 3.0.1, handling of "reference types" (java.util.concurrent.atomic.AtomicReference, java.util.Optional) is inconsistent: in case of "missing" (absent) value from incoming JSON, when passed via Constructor:

  1. AtomicReference is mapped to null (same as in 2.x and 3.0.0)
  2. Optional is mapped to Optional.empty() (same as in 2.x stand-alone module default)

but neither behavior is configurable. (also note that this mapping only matters for Creator-passed properties, including Records -- for Field/Setter settable, absent/missing value is never set).

Let's add a new DeserializationFeature to allow configuring this behavior.

Activity

  1. changed the title [-]Add `DeserializationFeature` for selecting `null` or "empty" value for missing `Optional` value[/-] [+]Add `DeserializationFeature` for selecting `null` or "empty" value when deserializing missing `Optional` value[/+] on Oct 16, 2025
  2. M-PRANAY commented on Oct 18, 2025

    @M-PRANAY

    Could I work on this?If Yes I will paste a skeleton and continue, please reply @cowtowncoder

  3. self-assigned this
    on Oct 19, 2025
  4. cowtowncoder commented on Oct 19, 2025

    @cowtowncoder
    MemberAuthor

    @M-PRANAY thank you -- I appreciate the offer -- but I think this is something I need to handle myself.

  5. changed the title [-]Add `DeserializationFeature` for selecting `null` or "empty" value when deserializing missing `Optional` value[/-] [+]Add `DeserializationFeature.USE_NULL_FOR_MISSING_REFERENCE_VALUES` for selecting `null` vs "empty/absent" value when deserializing missing `Optional` value[/+] on Oct 26, 2025
  6. added a commit that references this issue on Oct 26, 2025
    163a31d
  7. added this to the 3.1.0 milestone on Oct 26, 2025
  8. added a commit that references this issue on Oct 26, 2025
    67f8ef7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions