{
"ResponseType": "success",
"ResponseMessage": "success",
"Personal Preference": [
{
"Questionno": 3,
"TokenKey": "150920150252340989472d8d09fc6563",
"QuestionText": "Km per jaar",
"QuestionType": "Slider",
"QuestionOrder": 3,
"answerOptionList": [],
"Answer": "16014",
"Unit": "KM",
"Minimum": 1,
"Maximum": 100000,
"SliderOptionList": [
"<1000",
"1000-1500",
"1501-2000",
"2001-3000",
"3001-5000",
">5000"
]
以上是我使用Volley从服务器收到的JSON。我需要从这个JSON中获取Keys(ResponseType,ResponseMessage,Personal Preference:这些可能是varry)并存储在一个数组中。
答案 0 :(得分:1)
使用此代码
Iterator iterator = jsonObject.keys();
List<String> keysList = new ArrayList<String>();
while(iterator.hasNext()) {
String key = (String) iterator.next();
keysList.add(key);
}