首页 > 代码库 > Json 解析

Json 解析


JSONObject dataJson=new JSONObject(cpUserInfo);
    String vivoorder=dataJson.getString("vivoOrder");
    String  vivoSig=dataJson.getString("vivoSignature");
    String  uid=dataJson.getString("uid");
百度:
json格式如下:{"response":{"data":[{"address":"南京市游乐园","province":"江苏","district":"玄武区","city":"南京"}]},"status":"ok"}
希望得到结果是: 江苏 南京 玄武区 南京市游乐园
 
 
JSONObject  dataJson=new JSONObject("你的Json数据“);
JSONObject response=dataJson.getJSONObject("response");
JSONArray data=http://www.mamicode.com/response.getJSONArray("data");
JSONObject info=data.getJSONObject(0);
String province=info.getString("province");

String city=info.getString("city");

String district=info.getString("district");

String address=info.getString("address");

System.out.println(province+city+district+address);

Json 解析