jsonarray转化为List<jsonObject>
便于前端解析,需要转化。这里选择的是net.sf.json包。
//获取物流实体 JSONObject jc = JSONObject.fromObject(resultTrace); JSONArray jd = jc.getJSONArray("Traces"); List<JSONObject> list = new ArrayList<JSONObject>(); if(jd.size()>0){ for(int i=0;i<jd.size();i++){ Map<String, Object> map = new HashMap<String, Object>(); JSONObject jsonObject = jd.getJSONObject(i); String acceptTime = (String) jsonObject.get("AcceptTime"); String acceptStation = (String) jsonObject.get("AcceptStation"); map.put("acceptTime", acceptTime); map.put("acceptStation", acceptStation); list.add(JSONObject.fromObject(map)); } } return list;
相关推荐
somebodyoneday 2020-06-15
83163452 2020-01-28
adonislu 2020-01-10
baijinswpu 2020-01-01
adonislu 2019-12-31
xufankang 2019-12-19
somebodyoneday 2019-12-07
somebodyoneday 2019-10-30
ZCMUCZX 2016-04-14
WebVincent 2020-07-21
fengchao000 2020-07-04
baijinswpu 2020-06-28
88483063 2020-06-28
fengchao000 2020-06-16
wujiajax 2020-06-14
somebodyoneday 2020-05-16
xx0cw 2020-05-16
newthon 2020-05-14