Map<String,Object> map = new HashMap<String,Object>();map.put("datetime", datetime1);map.put("distance", re.getString("abe.jyz"));map.put("lat", re.getDouble("lat"));map.put("lng", re.getDouble("lng"));map.put("position", re.getString("pos"));JSONArray jsonob = JSONArray.fromObject(map);结果:map::{position=内蒙测试点, distance=500米以内, lng=111.78015, datetime=2016-07-18 17:51:47, lat=40.848366}map::{position=内蒙测试点, distance=700米以内, lng=111.78085, datetime=2016-07-18 18:06:47, lat=40.850674}json::[{"position":"内蒙测试点","distance":"700米以内","lng":111.78085,"datetime":"2016-07-18 18:06:47","lat":40.850674}]想让这两个map存入同一个json,就像下面一样,而不是只显示最后一个map;json::[{position=内蒙测试点, distance=500米以内, lng=111.78015, datetime=2016-07-18 17:51:47, lat=40.848366},{"position":"内蒙测试点","distance":"700米以内","lng":111.78085,"datetime":"2016-07-18 18:06:47","lat":40.850674}]
添加回答
举报
0/150
提交
取消