我有一个JSON文件,看起来像下面这样:
{"posts":[{"Latitude":"53.38246685","lontitude":"-6.41501535"},
{"Latitude":"53.4062787","lontitude":"-6.3767205"}]}
通过以下方法,我可以获取第一组纬度和经度坐标:
JSONObject o = new JSONObject(s);
JSONArray a = o.getJSONArray("posts");
o = a.getJSONObject(0);
lat = (int) (o.getDouble("Latitude")* 1E6);
lng = (int) (o.getDouble("lontitude")* 1E6);
有没有人知道如何获取所有的纬度和经度值?
非常感谢任何帮助。