How can I deserialize this JSON structure ?
[
{
"page": 1,
"per_page": "50"
},
[
{
"id": "IC.BUS.EASE.XQ",
"name": "ion"
},
{
"id": "OIUPOIUPOIU",
"name": "lal alalalal"
}
]
]
( I get this back from the WorldBank Api, it is a bit simplified, the exact response you find here ).
The problem is, that i get an array of objects, where the first element is a POJO and the second element is an array of POJOs of a specific type.
The only way that I found out to deserialize this is to be very generic which results in Lists and Maps.
List<Object> indicators = mapper.readValue(jsonString, new TypeReference<List<Object>>() {});
Is there a better way to deserialize this JSON to get an Array or a List, where the first element is of the Object "A" and the second a List of Objects "B" ?