I am writing an API on top of Spring Web MVC/Spring Hateoas and even if the deserialization of simple class hierarchy works like a charm, I cannot manage to deserialize Json input to the proper type using jackson.
Here is my class hierarchy :

Before everybody sends me to the many other similar questions on SO, the main difference here is that A is concrete. In other words, Jackson has to choose between 3 implementations by using the json fields as tie breakers.

1 Answer
1

There is no way to do that automatically: all automatic polymorphic type handling relies on type discriminator of some kind (type property, most commonly). Ability to use content-based heuristics has been requested, but so far no one has presented a viable plan (or contributions) for implementing functionality like this.

To handle it you will probably need to write a custom JsonDeserializer and detect type yourself. It might be possible to use ConvertingDeserializer, to let Jackson bind JSON into JsonNode or java.util.Map first, and then just extract it yourself.