2 keenkapotlj keenkapotlj 于 2017.09.16 22:48 提问

谷歌地图API的json问题

我知道怎么获取,但是我想获取其中的中文地级市 "long_name" : "甲米", 这个值,但是每一个json格式都不一样,,请问怎么获取呢?搞了一天了

{
"results" : [
{
"address_components" : [
{
"long_name" : "4203",
"short_name" : "4203",
"types" : [ "route" ]
},
{
"long_name" : "Tambon Ao Nang",
"short_name" : "Tambon Ao Nang",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Amphoe Mueang Krabi",
"short_name" : "Amphoe Mueang Krabi",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Chang Wat Krabi",
"short_name" : "จ.กระบี่",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "泰国",
"short_name" : "TH",
"types" : [ "country", "political" ]
},
{
"long_name" : "81000",
"short_name" : "81000",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "4203, Tambon Ao Nang, Amphoe Mueang Krabi, Chang Wat Krabi 81000泰国",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 8.0370574,
"lng" : 98.8187643
},
"southwest" : {
"lat" : 8.0363249,
"lng" : 98.8186267
}
},
"location" : {
"lat" : 8.036692,
"lng" : 98.8186996
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 8.038040130291503,
"lng" : 98.82004448029151
},
"southwest" : {
"lat" : 8.035342169708498,
"lng" : 98.81734651970849
}
}
},
"place_id" : "ChIJkVryNgrAUTARwjQ1NZprrlg",
"types" : [ "route" ]
},
{
"address_components" : [
{
"long_name" : "奧南",
"short_name" : "奧南",
"types" : [ "locality", "political" ]
},
{
"long_name" : "甲米府治縣",
"short_name" : "甲米府治縣",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "甲米",
"short_name" : "จ.กระบี่",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "泰国",
"short_name" : "TH",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "泰国甲米甲米府治縣奧南",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 8.090847499999999,
"lng" : 98.86611119999999
},
"southwest" : {
"lat" : 7.611651299999999,
"lng" : 98.7558902
}
},
"location" : {
"lat" : 8.0362834,
"lng" : 98.83281409999999
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 8.090847499999999,
"lng" : 98.86611119999999
},
"southwest" : {
"lat" : 7.611651299999999,
"lng" : 98.7558902
}
}
},
"place_id" : "ChIJuWMdUPq_UTAREB44LLwjAgQ",
"types" : [ "locality", "political" ]
},
{
"address_components" : [
{
"long_name" : "81180",
"short_name" : "81180",
"types" : [ "postal_code" ]
},
{

1个回答

as_csdn
as_csdn   2017.09.17 17:55

android studio中 有一个gsonformat插件,把json数据复制进去,点ok就行了

Csdn user default icon
上传中...
上传图片
插入图片