例如
"result": {
"ceshi": "测试",
"yingyu": "英语",
"hanyu": "中文",
"CANTONESE": "粤语"
}
JSONObject 提供了一个方法keys().
try {
JSONObject jsonObject = new JSONObject(jsonStr);
Iterator<String> keys = jsonObject.keys();
while (keys.hasNext()) {
String key = keys.next();
String value = jsonObject.optString(key);
Log.e("zmm", key + "--------->" + value);
}
} catch (JSONException e) {
e.printStackTrace();
}
解决