I am trying to parse a JSON structure similar to this one:
{
"cars": {
"112": {
"make": "Cadillac",
"model": "Eldorado",
"year": "1998"
},
"642": {
"make": "Cadillac",
"model": "Eldorado",
"year": "1990"
},
"9242": {
"make": "Cadillac",
"model": "Eldorado",
"year": "2001"
}
}}
I have a CarEntity class defined with makeName,model,year attributes defined and accessible via setters/getters.
I am trying to deserialize this JSON like this:
Map<String, CarEntity> deserialized = new JSONDeserializer<Map<String, CarEntity>>()
.use("cars.values", Map.class)
.deserialize(json);
and it doesn't work :( It does deserialize it but not into Map<String, CarEntity>
but rather into deep Map(something like Map<String, Map<String, Map<String, String>>>
)
What am I doing wrong?