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++; }