我想使用句点和值绘制图形,任何人都有任何关于将这些内部数组作为数组列表的想法?如何将这些内部数组解析为数组列表?
这是json:
{
"status": true,
"success": true,
"message": "Food consumed graph result",
"periods": {
"0": "Anytime",
"1": "Breakfast",
"2": "Morning Snack",
"3": "Lunch",
"4": "Afternoon Snack",
"5": "Dinner"
},
"values": {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0
},
"chartTitle": "Calorie intake over today",
"xTitle": "periods",
"yTitle": "calories",
"tooltipText": "Calorie consumed",
"tooltipUnit": "cal"
}
答案 0 :(得分:1)
尝试以下内容:
JSONObject vals = jsonObj.getJSONObject("values");
Map<String,String> map = new HashMap<String,String>();
Iterator iter = vals.keys();
while(iter.hasNext()){
String key = (String)iter.next();
String value = vals.getString(key);
map.put(key,value);
}