Java解析json数据

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


JSONObject  dataJson=new JSONObject("你的Json数据“);
JSONObject  response=dataJson.getJSONObject("response");
JSONArray data=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);

你可能感兴趣的:(Java解析json数据)