jackson-lombok
jackson-lombok copied to clipboard
Error deserialising an object containing a List
Hi
Trying to deserialize into this object
@Value
public static class Dto {
private List<String> data;
}
but I'm getting an error:
JsonMappingException: Can not deserialize instance of java.util.ArrayList out of FIELD_NAME token
Reproducer:
public static void main(String[] args) throws Exception {
ObjectMapper mapper = new ObjectMapper()
.setAnnotationIntrospector(new JacksonLombokAnnotationIntrospector());
Dto dto = mapper.readValue("{\"data\":[\"ASD\",\"BBB2\"]}", Dto.class);
System.out.println(dto);
}
Is this a bug or am I using it wrong?