解析一下数据格式:
String result = {"errorCode":"0","info":{"16":[0,30],"17":[0,30],"18":[0,30],"19":[0,30],"20":[0,30],"21":[0,30],"22":[0,30],"23":[0,30]},"msg":"操作成功","status":"1","token":""}
(fastjson解析会有顺序错乱问题)
//原生JSON解析
JSONObject js = new JSONObject(result);
TreeMap> mHourMaps = new TreeMap>();
Iterator it = js.keys();
//遍历jsonObject数据,添加到Map对象
while (it.hasNext()){
String key = String.valueOf(it.next());
JSONArray array = js.getJSONArray(key);
List list = JsonUtility.fromList(array.toString(), String.class);
mHourMaps.put(key, list);
}
2