日期:2014-05-17  浏览次数:20809 次

这个json要怎么解析?
[{"36801":"hhh","36802":"hop","36800":"pppp","36803":"jjjjj"}]
我要得到后面的hhh,hop,pppp,jjjjj这些数据我要怎么做???


------解决方案--------------------
一贴多发,lz很大方啊,好吧,看代码:
Java code
String json = "[{\"36801\":\"hhh\",\"36802\":\"hop\",\"36800\":\"pppp\",\"36803\":\"jjjjj\"}]";
        System.out.println(json);
        JSONArray array = JSONArray.fromObject(json);// json数组
        for (int i = 0; i < array.size(); i++) {
            JSONObject object = (JSONObject) array.get(i);
            System.out.println(object.getString("36801"));
            System.out.println(object.getString("36802"));
            System.out.println(object.getString("36800"));
            System.out.println(object.getString("36803"));
        }

------解决方案--------------------
探讨

一贴多发,lz很大方啊,好吧,看代码:
Java code
String json = "[{\"36801\":\"hhh\",\"36802\":\"hop\",\"36800\":\"pppp\",\"36803\":\"jjjjj\"}]";
System.out.println(json);
JSONArray array = JSONArray.f……