Jackson custom deserializer for one field with polymorphic types Jackson custom deserializer for one field with polymorphic types json json

Jackson custom deserializer for one field with polymorphic types


Jackson processes @JsonTypeInfo before choosing which Deserializer to use, probably because the choice of Deserializer could depend generally on the type. However, you can easily disable this on a per-field basis the same way you specify custom Deserializer - by annotating the field directly:

@JsonDeserialize(using = DefinitionDeserializer.class)@JsonTypeInfo(use = JsonTypeInfo.Id.NONE)private Definition definition;