This is the structure of the JSON that I need to transform:
{
"United Kingdom": {
"visit_count": 2,
"cities": {
"London": 2
}
},
"Netherlands": {
"visit_count": 1182,
"cities": {
"Amsterdam": 441
}
}
}
Which is basically a JSonObject, which contains an array of objects, BUT the key is the name of the country, and the right part, are the properties of the object. The same goes for the "Cities" JsonObject. Now I tried doing this with jsonschema2pojo, but it tries to create objects after the name of the countries (United Kingdom, Netherlads) when this objects are actually the same type. I was thinking of somehow loading the json into a hashmap, but don't know how exactly to do that. Is is possible?
Use google's Gson, it works excellent.
https://code.google.com/p/google-gson/
And take a look into here