JAVA解析JSON 只解析一条数据

求个小例子啊,小白一枚求指导~~~~~~~~~~~JAVA解析JSON 只解析一条数据


        JSONObject tokenInfo = new JSONObject(jsonText);


        weixinBackInfo=new WeixinBackInfo();
        weixinBackInfo.setAccess_token(tokenInfo.getString("access_token"));
        weixinBackInfo .setOpenid(tokenInfo.getString("openid"));
        weixinBackInfo.setExpires_in(tokenInfo.getInt("expires_in"));
        weixinBackInfo.setRefresh_token(tokenInfo.getString("refresh_token"));
        weixinBackInfo.setScope(tokenInfo.getString("scope"));
public static void main(String[] args) {
         String s = "{\"aa\":\"bb\"}";
         JSONObject ss = (JSONObject)JSONObject.parse(s);
         System.out.println(ss.getString("aa"));
    } 

使用的是fastjson

json格式如下:{"response":{"data":[{"address":"南京市游乐园","province":"江苏","district":"玄武区","city":"南京"}]},"status":"ok"}

JSONObject  dataJson=new JSONObject("你的Json数据“);
JSONObject  response=dataJson.ge......
答案就在这里:Java解析json数据
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

自己注意节点的关键字,JSON解析是需要对准键值的。
JsonObject jsonObject = new JSONObject(json)//json是服务器返回的json字符串。
CityWeather cityWeather = new CityWeather();
cityWeather.setAreaId(jsonObject.optString("areaId"));