Skip to content

Deserialization issue with @JsonIgnore and @JsonCreator + @JsonProperty for same property name #2001

Closed
@jskierbi

Description

@jskierbi

Issue originally found on jackson-module-kotlin: FasterXML/jackson-module-kotlin#124. Issue reproducible with Java code.

Entity class:

static public class Foo {
  @JsonIgnore 
  public String query;

  @JsonCreator
  @ConstructorProperties("rawQuery")
  public Foo(@JsonProperty("query") String rawQuery) {
    query = rawQuery;
  }
}

Fails this test:

Foo deserialized = new ObjectMapper().readValue("{\"query\": \"bar\"}", Foo.class);
assertEquals("bar", deserialized.query);

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