【发布时间】:2017-09-22 07:37:30
【问题描述】:
JSON 看起来像这样:
{
"00AK": {
"icao": "00AK",
"iata": "",
"name": "Lowell Field",
"city": "Anchor Point",
"country": "US",
"elevation": 450,
"lat": 59.94919968,
"lon": -151.695999146,
"tz": "America\/Anchorage"
},
"00AL": {
"icao": "00AL",
"iata": "",
"name": "Epps Airpark",
"city": "Harvest",
"country": "US",
"elevation": 820,
"lat": 34.8647994995,
"lon": -86.7703018188,
"tz": "America\/Chicago"
},
"00AZ": {
"icao": "00AZ",
"iata": "",
"name": "Cordes Airport",
"city": "Cordes",
"country": "US",
"elevation": 3810,
"lat": 34.3055992126,
"lon": -112.1650009155,
"tz": "America\/Phoenix"
}
}
如您所见,键有“00AK”、“00AL”、“00AZ”等等。如何解析这种格式的 JSON?
【问题讨论】:
-
键对解析有什么影响?只需像其他任何方法一样解析 json,您的实际问题是如何从解析的 json 中检索数据?
-
你可以google一下,搜索关键字jsonObject。那里有大量的样本。祝你好运!