我用JSONObject jsonObject = JSONObject.fromObject(body);获取的json为
{"access_token":"2:0CEunTZet07nlSft:wFnM6JVNrC2CJwjB","location":{"longitude":113.920779,"accuracy":626,"address":{"street_number":"3065号","country":"中国","street":"南山大道","region":"广东省","city":"深圳市","country_code":"CN"},"latitude":22.543963}}求解析方法,先谢谢咯

解决方案 »

  1.   

    http://code.google.com/p/json-simple/
      

  2.   


    {"access_token":"2:0CEunTZet07nlSft:wFnM6JVNrC2CJwjB",
     "location":{
        "longitude":113.920779,
        "accuracy":626,
        "address":{
            "street_number":"3065号",
            "country":"中国",
            "street":"南山大道",
            "region":"广东省",
            "city":"深圳市",
            "country_code":"CN"
        },
        "latitude":22.543963
      }
     }
    你要解析成什么样子哈?
    就是提取里面的数据?
    有无对应的Bean?
      

  3.   

    自己写一个方法,根据自己需要解析不好吗?我在做Javascript的时候就这样的
      

  4.   

    String country= jsonObject.optJSONObject("location").optJSONObject("address").optJSONObject("country");其它的都这样取了,呵呵!
      

  5.   

    String country= jsonObject.optJSONObject("location").optJSONObject("address").optString("country");呵呵,刚才写错了