JSONObject,JSONArray
发布时间:2020-12-16 19:02:42 所属栏目:百科 来源:网络整理
导读:JSON和JSONObject,JSONArray的关系,类似于Map和HashMap com.alibaba.fastjson.JSONObject obj = com.alibaba.fastjson.JSON.parSEObject(getPrice(cityName)); com.alibaba.fastjson.JSONArray array2 = com.alibaba.fastjson.JSON.parseArray(obj.getString
JSON和JSONObject,JSONArray的关系,类似于Map和HashMap com.alibaba.fastjson.JSONObject obj = com.alibaba.fastjson.JSON.parSEObject(getPrice(cityName)); com.alibaba.fastjson.JSONArray array2 = com.alibaba.fastjson.JSON.parseArray(obj.getString("PriceItems")); int i = 0; Map<String,Object> time = new HashMap<String,Object>(); for (Object a : array2) { com.alibaba.fastjson.JSONObject o = (com.alibaba.fastjson.JSONObject) a; time.put("Tstart" + i,o.get("Tstart")); time.put("Tend" + i,o.get("Tend")); time.put("Price" + i,o.get("Price")); i++; }(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |