jackson-lombok icon indicating copy to clipboard operation
jackson-lombok copied to clipboard

Error deserialising an object containing a List

Open ajermakovics opened this issue 8 years ago • 0 comments

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?

ajermakovics avatar Apr 27 '16 16:04 ajermakovics