我試圖從經度和緯度檢索郵政編碼。因此我使用google API。獲取谷歌JSON之外的郵政編碼
這是我的要求。
當你在你的瀏覽器中輸入這個,你會看到整個JSON。這只是它的一部分。
JSON文件
{
"results": [
{
"address_components": [
{
"long_name": "2",
"short_name": "2",
"types": [
"street_number"
]
},
{
"long_name": "Hermisweg",
"short_name": "Hermisweg",
"types": [
"route"
]
},
{
"long_name": "Opglabbeek",
"short_name": "Opglabbeek",
"types": [
"locality",
"political"
]
},
{
"long_name": "Limburg",
"short_name": "LI",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "Vlaams Gewest",
"short_name": "Vlaams Gewest",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "België",
"short_name": "BE",
"types": [
"country",
"political"
]
},
{
"long_name": "3660",
"short_name": "3660",
"types": [
"postal_code"
]
}
]
}
]
}
我的問題是現在我怎樣才能從這個JSON的郵政編碼嗎?在這個例子中,我想要3660作爲輸出。
有人有想法嗎?
那麼你的問題是什麼?如何閱讀JSON?這與Google地圖無關。 – Marcelo 2013-02-27 10:30:14
@Marcelo我知道如何閱讀json。但是我無法從JSON中獲取郵政編碼。 – Steaphann 2013-02-27 10:31:38