Michael
Michael

Reputation: 593

Response from geocoding API

I'm able to get the fully formatted address from the api,

"1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"

for example.

How do i "breaking to pieces" this formatted address(city, street, country etc)?

code for getting the fully address -

   final formattedAddress =decodedResponse['results'][0]['formatted_address']

Upvotes: 3

Views: 1256

Answers (1)

Michael
Michael

Reputation: 593

According to the result from the api(https://developers.google.com/maps/documentation/geocoding/intro#GeocodingResponses)

I can write decodedResponse['results'][0]['address_components'][0]['long_name']

The second [0] indicate the location of the type

Upvotes: 2

Related Questions