A simple way to enable polymorphic serialization / deserialization via Jackson library is to globally configure the Jackson object mapper (jackson.databind.ObjectMapper) to add information, such as the concrete class type, for certain kinds of classes, such as abstract classes.
To do that, just make sure your mapper is configured correctly. For example:
Option 1: Support polymorphic serialization / deserialization for abstract classes (and Object typed classes)
jacksonObjectMapper.enableDefaultTyping(
ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE);
Option 2: Support polymorphic serialization / deserialization for abstract classes (and Object typed classes), and arrays of those types.
jacksonObjectMapper.enableDefaultTyping(
ObjectMapper.DefaultTyping.NON_CONCRETE_AND_ARRAYS);
Reference: https://github.com/FasterXML/jackson-docs/wiki/JacksonPolymorphicDeserialization