I used the JsonTypeInfo to correctly deserialize the json to appropriate sub-types
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
public abstract class Car {
}
public class Audi extends Car {
// Getters and Setters
}
public class Merc extends Car {
// Getters and Setters
}
For the following structure - Map<String, Car> info
Here is my sample JSON
{
info: {
"xyz": {
type: "Audi"
},
"abc": {
type: "Merc"
}
}
}
The above JSON does not deserialize correctly and get the error 400: Unable to process JSON. What am I missing here ?