I have this json object and i need to know the "package" of a given "name", for example, i need to know the package, of "item2", in java code
{
"package1": {
"name": "item1",
"type": "i"
},
"package2": {
"name": "item2",
"type": "i"
},
"package3": {
"name": "item3",
"type": "i"
}
}
i know how to get a specific "package" from the json with the following code:
JSONObject json = new JSONObject(jsonString);
// Get childObject json
JSONObject childObject=json.getJSONObject("package2");
but i don't know how to get the package string giving a sub item like "name".
Thanks in advance!