我如何遍历JSONObject中的这个JSON字符串?:
[
{"Suggestion": "Roosendaal"},
{"Suggestion": "Rucphen"},
{"Suggestion": "Rijsbergen"},
{"Suggestion": "Rijen"},
{"Suggestion": "Raamsdonksveer"},
{"Suggestion": "Raamsdonk"},
{"Suggestion": "Rijswijk NB"}
]
答案 0 :(得分:0)
我想你正在使用org.json。
JSONArray array = new JSONArray(s);
int length = array.length();
for (int i = 0; i < length; i++) {
JSONObject o = array.getJSONObject(i);
System.out.println(o);
}
s
是String
。