My json
response:
{
"Countries": [
{
"Country": "China",
"Alpha2": "CN",
"Alpha3": "CHN",
"numbers": {
"Jon": "100",
"Mat": "200",
"SAM": "300"
}
},
{
"Country": "Italy",
"Alpha2": "IT",
"Alpha3": "ITA",
"numbers": {
"Benny": "400",
"Jack": "500"
}
}
]
}
My code:
for (int i = 0; i < m_jArry.length(); i++) {
JSONObject jo_inside = m_jArry.getJSONObject(i);
if (jo_inside.getString("Country").equals("Italy"))
{
Log.d("DTAG",jo_inside.getString("Country"));
Log.d("DTAG",jo_inside.getString("Alpha2"));
Log.d("DTAG", jo_inside.getString("Alpha3"));
JSONObject jo_inside2 = jo_inside.getJSONObject("numbers");
Log.d("DTAG", "Size: "+jo_inside2.length());
for (int j=0;j<jo_inside2.length();j++)
{
//???
}
}
How can I get the name of value and his value? For this example I need to get Benny 400, Jack 500