如何获取日期数组中的键我可以解析直到'2'如何获得19:00:00
"date_times": {
"2": {
"2018-01-08": [
**"19:00:00"**
],
"2018-01-09": [
"13:30:00",
"19:00:00"
],
"2018-01-10": [
"13:30:00",
"19:00:00"
],
"2018-01-11": [
"13:30:00",
"19:00:00"
]
}
}
答案 0 :(得分:1)
如果您担心从jsonobject
获取密钥。然后在Iterator
上使用keys
。
try {
JSONObject resObject = new JSONObject(response);
Iterator<String> iterator = resObject.keys();
while (iterator.hasNext()) {
String key = iterator.next();// this will be your date
JSONArray data = resObject.getJSONArray(key);// And this is your data
}
} catch (Exception e) {
}
这只是一个根据您的需要进行修改的示例