java读取json格式数据 jsoniteratorjava 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 location和detail_info和上边的一样的解析 ,你都能解析一部分了 ,我想剩下的也能解析。 String location = json_location.getString("location"); String details = json_details.getString("detail_info");JSONObject location =JSONObject.fromObject(location );JSONObject details =JSONObject.fromObject(details );details .getString("environment_rating");要说取啥就行了 。JSONObject 就是 json字符串和javaBean的中间对象 , 你要是不json 转成java对象 就得这么转, 你应该是哪里写的不对 。 public static void main(String[] args) throws IOException { JSONArray jsonArray = searchLocation("芜湖"); Iterator iteratorArray = jsonArray.iterator(); while (iteratorArray.hasNext()) { JSONObject json = (JSONObject) iteratorArray.next(); String results = json.getString("results"); JSONArray resultArray = JSONArray.fromObject(results); Iterator iteratorResult = resultArray.iterator(); while (iteratorResult.hasNext()) { JSONObject iteratorJson = (JSONObject) iteratorResult.next(); System.out.println(iteratorJson.getString("name")); System.out.println(iteratorJson.getString("address")); System.out.println(iteratorJson.getString("telephone")); System.out.println(iteratorJson.getString("uid")); String location = iteratorJson.getString("location"); String details = iteratorJson.getString("detail_info"); JSONObject location =JSONObject.fromObject(location ); JSONObject details =JSONObject.fromObject(details ); System.out.println(details .getString("environment_rating")); } } } map里有map 该怎么遍历就怎么遍历 Java服务器端,获取手持采集器(winCE系统,C# client)上的数据 求指教:写一个函数将一个整数反转 tomcat7.0 和6.0对request。getRequestDispatcher()。include()的支持 方法覆盖问题 Axis最简单的例子,但是跑不通 求4道Java和JavaScript相关的题解答 如何进行代码的封装? JAVA连接ACCESS的问题 请问哪里可以下载到‘Sun认证Java2程序员学习指南(Exam 310-025)第二版(英文影印本)’这本书 如何编写EJB的客户端程序? [提问题]C3P0挂起 servlet的入门问题、、、
String location = json_location.getString("location");
String details = json_details.getString("detail_info");
JSONObject location =JSONObject.fromObject(location );
JSONObject details =JSONObject.fromObject(details );
details .getString("environment_rating");要说取啥就行了 。JSONObject 就是 json字符串和javaBean的中间对象 ,
JSONArray jsonArray = searchLocation("芜湖");
Iterator iteratorArray = jsonArray.iterator();
while (iteratorArray.hasNext()) {
JSONObject json = (JSONObject) iteratorArray.next();
String results = json.getString("results");
JSONArray resultArray = JSONArray.fromObject(results);
Iterator iteratorResult = resultArray.iterator();
while (iteratorResult.hasNext()) {
JSONObject iteratorJson = (JSONObject) iteratorResult.next();
System.out.println(iteratorJson.getString("name"));
System.out.println(iteratorJson.getString("address"));
System.out.println(iteratorJson.getString("telephone"));
System.out.println(iteratorJson.getString("uid"));
String location = iteratorJson.getString("location");
String details = iteratorJson.getString("detail_info");
JSONObject location =JSONObject.fromObject(location );
JSONObject details =JSONObject.fromObject(details );
System.out.println(details .getString("environment_rating"));
}
}
}