You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ACCEPT_CASE_INSENSITIVE_PROPERTIES not applied to @JsonUnwrapped properties #6247
With MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES enabled, properties of a @JsonUnwrapped value are only matched if the input name has exactly the same case as the property name; names that differ in case are silently ignored (no exception, value left null).
This happens both with and without prefix, and for both field and Creator properties.
(Noticed while working on #6246, which fixed exact-case matching of Creator properties for @JsonUnwrapped with prefix/suffix when case-insensitivity is enabled.)
Reproduction
staticclassOuter {
@JsonUnwrapped(prefix = "inner-")
publicInnerinner;
}
staticclassOuterNoPrefix {
@JsonUnwrappedpublicInnerinner;
}
staticclassInner {
publicStringmyName;
}
ObjectMappermapper = JsonMapper.builder()
.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
.build();
// All of these fail: `inner.myName` is `null`mapper.readValue("{\"INNER-MYNAME\":\"b\"}", Outer.class);
mapper.readValue("{\"inner-MYNAME\":\"b\"}", Outer.class);
mapper.readValue("{\"MYNAME\":\"b\"}", OuterNoPrefix.class);
// whereas exact-case names work:mapper.readValue("{\"inner-myName\":\"b\"}", Outer.class);
Same for a Creator-only Inner (@JsonCreator constructor with @JsonProperty("myName"), no setter or field).
Expected
Unwrapped properties should be matched case-insensitively, same as regular properties.
Version
Observed on 3.1 branch (3.1.x-SNAPSHOT); not yet checked on 2.x.
Activity
Fix FasterXML#6247: match @JsonUnwrapped names case-insensitively