Skip to content

deserialized JsonAnySetter field is null  #4508

@m-valeev

Description

@m-valeev

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

I have kotlin data class

data class Request(
    @JsonProperty("header")
    override val header: String? = null,
    @JsonIgnore
    @JsonAnySetter
    @JsonAnyGetter
    val additionProperties: Map<String, Any?>? = null,
) : Parent(header)

and json

      {
            "payloadType": "perform",
            "data":{
              "header": "lol",
              "type": "sometype",
              "any_other_data": {
                  "field1": "1",
                  "field2": "",
                  "field3": "",
                  "field4": {
                      "field5": "",
                      "field6": "",
                      "field7": "anytext"
                  }
              }
            }
        }

Before jackson 2.17.0 the json deserialized into class correctly. any_other_data put to additionalProperties map.
On 2.17.0 version i have additionalProperties == null after the deserialization.

Version Information

2.17.0

Expected behavior

i expected that field annotated with @JsonAnySetter will be filled with all the undeclared fields

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.18Issues planned at 2.18 or later

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions