[
{
"hit": "1"
},
{
"SUM(hit)": "196290"
},
{
"COUNT(id)": "4010"
}
]
如何在android中读取这种json o / p
答案 0 :(得分:0)
//You can use below code for parsing this kind of jsonarray
String yourResponse;
JSONArray jsonarray = new JSONArray(yourResponse);
for (int i = 0; i < jsonarray.lenght(); i++){
JSONObject jsonobject = jsonarray.getJSONObject(i);
if(jsonobject.has("hit"){
String hit = jsonobject.getString("hit");
}
if(jsonobject.has("SUM(hit)"){
String sumHit = jsonobject.getString("SUM(hit)");
}
if(jsonobject.has("COUNT(id)"){
String countID = jsonobject.getString("COUNT(id)");
}
}