挂接终结点:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Hoboken%20NJ&fields=formatted_address,name&inputtype=textquery&key=xxxxxxxxxxxxxxxxxxx
得到结果:
{
"candidates" : [
{
"formatted_address" : "New Jersey, USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
令我恼火的是,我找不到一种方法把地区和国家分开-
是的,我知道我可以自己分析结果
.但是,有没有一个选项可以让google places api在返回的json中将响应分离出城市/州(或地区)/国家?
类似于:
{
"candidates" : [
{
"state" : "New Jersey",
"country" : "USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}