Skip to content

Allow for multiple @JsonAnySetter when @JsonUnwrapped is supplied #2877

Open
@raphw

Description

@raphw

I am dealing with JSON where properties for certain areas are prefixed with given values. For example,

{
  "key" : "val1",
  "@key" : "val2",
  "$key" : "val3"
}

should be represented as a bean of three categories of property:

class Bean {
  @JsonAnySetter
  Map<String, String> normal;
  @JsonAnySetter
  @JsonUnwrapped(prefix = "@")
  Map<String, String> ats;
  @JsonAnySetter
  @JsonUnwrapped(prefix = "$")
  Map<String, String> dollars;
}

I understand that this is rather comples but the serialization works just fine. It would be brilliant being able to deserialize a JSON property if any property would only match one of the unwrapped specifications whereas any other property would end up in the non-unwrapped target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions