JSONArray cities = json.getJSONArray("city");
使用上面的代码得到以下输出:
{
"id":"1",
"name":"London"
"country":"United Kingdom"
},
{
"id":"2",
"name":"Madrid"
"country":"Spain"
},
{"id":"3",
"name":"Paris"
"country":"France"
},
{
"id":"3",
"name":"Zurich"
"country":"Switzerland"
}
如何仅将 JSON 数组中的名称获取到字符串数组?
例如:String[] s ={"London","Madrid","Paris","Zurich"}