I have a response with an array that has the components of the address listed as House Number, Street Name, City, State, Country, Zip etc. with each of them looking like this:
{
“long_name” : “United States”,
“short_name” : “US”,
“types” : [ “country”, “political” ]
},
{
“long_name” : “20817”,
“short_name” : “20817”,
“types” : [ “postal_code” ]
},
I just want the postal code, but it is not always in the same position in the array since some areas will also have other things listed above it such as locality, administrative area etc. How can I say I want the nth position of the array IF the “types” is postal_code?
This is from the Google API so I am hoping someone knows how I can do this!