【发布时间】:2021-10-19 11:18:24
【问题描述】:
我正在使用 google 自动完成地址 api,它返回所有必需的数据,但不返回邮政编码。知道如何在 api 响应中获取邮政编码。下面是这个 api 返回的我的 url 和 api 响应。
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=19becket st &types=address&key=my_api_key
数据返回格式如下
{
"description": "19 Becket St, Boston, MA, USA",
"matched_substrings": [
{
"length": 2,
"offset": 0
},
{
"length": 9,
"offset": 3
}
],
"place_id": "ChIJN9v2H4l744kRRg9DI6ctGhY",
"reference": "ChIJN9v2H4l744kRRg9DI6ctGhY",
"structured_formatting": {
"main_text": "19 Becket St",
"main_text_matched_substrings": [
{
"length": 2,
"offset": 0
},
{
"length": 9,
"offset": 3
}
],
"secondary_text": "Boston, MA, USA"
},
"terms": [
{
"offset": 0,
"value": "19"
},
{
"offset": 3,
"value": "Becket St"
},
{
"offset": 14,
"value": "Boston"
},
{
"offset": 22,
"value": "MA"
},
{
"offset": 26,
"value": "USA"
}
],
"types": [
"premise",
"geocode"
]
},
【问题讨论】:
标签: google-maps google-api googleplacesautocomplete