Jackson json provider linkedHashSet deserialization Jackson json provider linkedHashSet deserialization spring spring

Jackson json provider linkedHashSet deserialization


You can specify the concrete class for Jackson to use with the @JsonDeserialize annotation. Just put:

@JsonDeserialize(as=LinkedHashSet.class)

On the property's setter.


It all depends on what you ask the result type to be: if ask data to be mapped to a LinkedHashSet, then JSON Array gets mapped to it. If you use a vague type like java.lang.Object (or java.util.Collection), you will get ArrayList for JSON Arrays.Keep in mind that JSON is data, not objects (by default), so metadata regarding Java types you used is not passed by default. There are ways to do that, if you need it, but usually you will simply need to provide expected type.