I need to get the city from a given US Zipcode, and i'm having trouble with Boroughs like Brooklyn
im using geocode: https://maps.googleapis.com/maps/api/geocode/json?address=11214&key=KEY it returns this results
{
"address_components": [
{
"long_name": "11214",
"short_name": "11214",
"types": [
"postal_code"
]
},
{
"long_name": "Brooklyn",
"short_name": "Brooklyn",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
},
{
"long_name": "Kings County",
"short_name": "Kings County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"long_name": "New York",
"short_name": "NY",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"long_name": "United States",
"short_name": "US",
"types": [
"country",
"political"
]
}
],
"formatted_address": "Brooklyn, NY 11214, USA",
"geometry": {
"bounds": {
"northeast": {
"lat": 40.6163139,
"lng": -73.98259999999999
},
"southwest": {
"lat": 40.5788159,
"lng": -74.014775
}
},
"location": {
"lat": 40.6046106,
"lng": -73.9982756
},
"location_type": "APPROXIMATE",
"viewport": {
"northeast": {
"lat": 40.6163139,
"lng": -73.98259999999999
},
"southwest": {
"lat": 40.5788159,
"lng": -74.014775
}
}
},
"place_id": "ChIJLzmMV-BawokR4tFzc3LaBFI",
"types": [
"postal_code"
]
}
i need a way to link this to New York City, the only hint i see is
"long_name": "Brooklyn",
"short_name": "Brooklyn",
"types": [
"political",
"sublocality",
"sublocality_level_1"
]
maybe theres a way to link Brooklyn as a sublocality of NYC but i couldn't find it.