I receive JSON data from web service and I would like to convert it into Java object. The ways are many, however I don't find any that could deal with changeble array keys that I receive in the json.
JSON example:
{
"total": 2,
"last": "AAAI9Zgh",
"results": {
"67701510/2/1150671": {
"attributes": {
"200": "11444413213123",
"201": "Frank"
},
"id": "67701510/2/1150671"
},
"76701410/3/1330671": {
"attributes": {
"200": "11666613213123",
"201": "Mary"
},
"id": "76701410/3/1330671"
}
}
}
In the results there are 2 objects. Name of each object is an ID of the object so it is changeble. The method like this
return new Gson().fromJson(json, clazz);
is not working.
I would like to reach attributes and id data in each object.
Could anyone give some method to do so?
Map<String, yourObject>for the mapping.