我有以下json:
{
"count" : "1567",
"program" : ["NDBC Meteorological\/Ocean", "International Partners"],
"owner" : ["NDBC", "Alaska Ocean Observing System"],
"station" : [{
"id" : "00922",
"lat" : "30",
"lon" : "-90",
"name" : "OTN201 - 4800922"
}
]
}
我只需要获取, ,等station
信息。但我无法让它工作,这是我的代码:id
lat
lon
name
//////response_str is the json string///////
JSONArray pages = new JSONArray(response_str);
for (int i = 0; i < pages.length(); ++i) {
JSONObject rec = pages.getJSONObject(i);
JSONObject jsonPage =rec.getJSONObject("station");
String name= jsonPage.getString("name");
System.out.println(name);
}
任何帮助将不胜感激,问候