开发者

JSON:How to handle JSON response like this?

开发者 https://www.devze.com 2023-04-10 06:43 出处:网络
Here is the Response I wonder how can I handle a JSON Response like this? This a JSONArray, but didn\'t have a name

Here is the Response I wonder how can I handle a JSON Response like this? This a JSONArray, but didn't have a name Here is the response:

[[84,"sinat","qq357068756@163.com"],[88,"msn","qq357068756@hotmail.com"],[89,"163t","qq357068756@hotmail.com"],[90,"mail","qq357068756@hot开发者_如何学JAVAmail.com"],[93,"mail","qq357068756@163.com"]]


Data are not JSONObject but JSONArray !

String json_value = '[[84,"sinat","qq357068756@163.com"],[88,"msn","qq357068756@hotmail.com"],[89,"163t","qq357068756@hotmail.com"],[90,"mail","qq357068756@hotmail.com"],[93,"mail","qq357068756@163.com"]]';

JSONArray json_array = new JSONArray(json_value);

and walk through it like

for(int i = 0; i < json_array.length(); i++){
    Log.d("Current index: "+i,"Current value: "+json_array.getJSONArray(i).toString());
}
0

精彩评论

暂无评论...
验证码 换一张
取 消