Skip to content

Allow values of "untyped" auto-convert into List if duplicates found (for XML) #2733

@cowtowncoder

Description

@cowtowncoder

(note: similar to #2732, but for Untyped deserialization)
(note: pre-req for FasterXML/jackson-dataformat-xml#205)

With XML there is a problem of how to represent sequences of repeating elements: these are exposed via streaming API as "duplicate" properties. Currently (2.11) Jackson simply replaces existing element (unless duplicate detection enabled, in which case exception may be thrown).
But for just XML it seems better to actually use coercion in which repeating elements are collected under logical List instead.

Detection of case for this handling can be determined using new

DeserializationContext.isEnabled(StreamReadCapability.DUPLICATE_PROPERTIES)

mechanism, which will trigger only for XML currently, but potentially for other formats where similar behavior makes sense, if any.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions