В моем приложении я получаю длинные данные от Google. я знаю, что мы можем повторить и получить значение. Но я уверен, что результат Google всегда будет таким же, как я получил. В таком случае, каков был бы правильный подход, чтобы название страны всегда было безопасным?
вот результат, который я получаю по умолчанию:
{
"results": [
{
"address_components": [
{
"long_name": "49",
"short_name": "49",
"types": [
"street_number"
]
},
{
"long_name": "Sydenhams Road",
"short_name": "Sydenhams Rd",
"types": [
"route"
]
},
{
"long_name": "Park Town",
"short_name": "Park Town",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
},
{
"long_name": "Chennai",
"short_name": "Chennai",
"types": [
"locality",
"political"
]
},
{
"long_name": "Chennai",
"short_name": "Chennai",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "Tamil Nadu",
"short_name": "TN",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "India",
"short_name": "IN",
"types": [
"country",
"political"
]
},
{
"long_name": "600003",
"short_name": "600003",
"types": [
"postal_code"
]
}
],
"formatted_address": "49, Sydenhams Rd, Park Town, Chennai, Tamil Nadu 600003, India",
"geometry": {
"location": {
"lat": 13.0826869,
"lng": 80.27050659999999
},
"location_type": "ROOFTOP",
"viewport": {
"northeast": {
"lat": 13.0840358802915,
"lng": 80.2718555802915
},
"southwest": {
"lat": 13.0813379197085,
"lng": 80.2691576197085
}
}
},
"place_id": "ChIJ11Py-v1lUjoROzu_lR9o7io",
"types": [
"street_address"
]
},
{
"address_components": [
{
"long_name": "Raja Flats",
"short_name": "Raja Flats",
"types": [
"establishment",
"point_of_interest"
]
},
{
"long_name": "School Street",
"short_name": "School St",
"types": [
"route"
]
},
{
"long_name": "Srinivasa Nagar",
"short_name": "Srinivasa Nagar",
"types": [
"political",
"sublocality",
"sublocality_level_2"
]
},
{
"long_name": "Perambur",
"short_name": "Perambur",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
},
{
"long_name": "Chennai",
"short_name": "Chennai",
"types": [
"locality",
"political"
]
},
{
"long_name": "Chennai",
"short_name": "Chennai",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "Tamil Nadu",
"short_name": "TN",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "India",
"short_name": "IN",
"types": [
"country",
"political"
]
},
{
"long_name": "600110",
"short_name": "600110",
"types": [
"postal_code"
]
}
],
"formatted_address": "Raja Flats, 600003, School St, Srinivasa Nagar, Perambur, Chennai, Tamil Nadu 600110, India",
"geometry": {
"location": {
"lat": 13.0826802,
"lng": 80.2707184
},
"location_type": "GEOMETRIC_CENTER",
"viewport": {
"northeast": {
"lat": 13.0840291802915,
"lng": 80.27206738029152
},
"southwest": {
"lat": 13.0813312197085,
"lng": 80.26936941970851
}
}
},
"place_id": "ChIJkRKg-_1lUjoR5ts0tmVrxMg",
"types": [
"establishment",
"point_of_interest"
]
}
],
"status": "OK"
}