{
"type":
"coll",
"locations":[
{"geometry":
{"Coords":
[54.7,46.7]
}
},
{"geometry":
{"Coords":
[54.7,46.7]
}
},
{"geometry":
{"Coords":
[54.7,46.6]
}
},
{"geometry":
{"Coords":
[54.64999833333333,46.6]
}
}
]
}
答案 0 :(得分:0)
在使用json.simple的java中,这里的代码如下: 这里我假设json数据存在于file.json
中 Object obj = parser.parse(new FileReader( "file.json" ));
JSONObject jsonObject = (JSONObject) obj;
JSONArray loc= (JSONArray) jsonObject.get("locations");
Iterator i = loc.iterator();
while (i.hasNext()) {
JSONObject geo = (JSONObject) (i.next());
JSONObject coords = (JSONObject)geo.get("geometry");
String coord= (String)coords.get("Coords");
System.out.println(coord);
}