Search before asking
- [X] I searched in the issues and found nothing similar.
Describe the bug
- When deserializing, variables with a second uppercase letter are not recognized
- After use
@JsonProperty("mValue")
, deserialization success. BUT the json string has two field "mValue" and "mvalue"
Version Information
2.14.0 to 2.15.2
Reproduction
@Data
public class JacksonModel {
private String code;
private List<JacksonData> data;
@Data
public static class JacksonData {
private Long id;
@JsonProperty("mValue")
private List<JacksonVal> mValue;
}
@Data
public static class JacksonVal {
private String k;
private Integer v;
}
}
public static void main(String[] args) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
String json = "{\"code\":\"success\",\"data\":[{\"id\":224570001,\"mValue\":[{\"k\":\"2023-07-22\",\"v\":100},{\"k\":\"2023-07-23\",\"v\":200}]}]}";
System.out.println(json);
JacksonModel result0 = objectMapper.readValue(json, JacksonModel.class);
json = objectMapper.writeValueAsString(result0);
System.out.println(json);
result0 = objectMapper.readValue(json, JacksonModel.class);
json = objectMapper.writeValueAsString(result0);
System.out.println(json);
}
Expected behavior
No response
Additional context
No response
Comment From: yawkat
Please make a test case that does not use lombok. This is likely a lombok-related problem.
Comment From: maleeeei
Please make a test case that does not use lombok. This is likely a lombok-related problem. change the setter and getter method to getmValue and setmValue , it works. thanks
Comment From: JooHyukKim
You mean,
changed the setter and getter method to getmValue and setmValue , it works. thanks
... right, @maleeeei?
Comment From: cowtowncoder
No stand-alone reproduction, closing.
Comment From: cowtowncoder
Re-opening, planning to address for Jackson 2.20.
Comment From: cowtowncoder
Will be fixed as part of #5152, closing again.