JSON:如何处理这样的JSON响应?

时间:2011-09-30 12:21:43

标签: android json

这是响应 我想知道如何处理像这样的JSON响应? 这是一个JSONArray,但没有名字 以下是回复:

[[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"]]

1 个答案:

答案 0 :(得分:1)

数据不是JSONObject,而是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);

并像

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