[Google Places] How to retrieve further information from JSON file

[Google Places] How to retrieve further information from JSON file

  
Forge Component
(5)
Published on 3 Apr by Ouen Worth
5 votes
Published on 3 Apr by Ouen Worth

How do you retrieve further information from the JSON file such as State, for instance I see the information in the JSON file {"long_name":"Queensland","short_name":"QLD","types":["administrative_area_level_1","political"]},


How do i retrieve Queensland or QLD? 

Solution

You will need to loop through the Address_components of the Results and test for Types = "administrative_area_level_1". When you find a match, then you can assign the Long_name or the Short_Name to the target object or variable that you want to use it with.

Is this enough detail to get you unstuck?

Solution

Charles Papp wrote:

You will need to loop through the Address_components of the Results and test for Types = "administrative_area_level_1". When you find a match, then you can assign the Long_name or the Short_Name to the target object or variable that you want to use it with.

Is this enough detail to get you unstuck?

Hi Charles,


A little (a lot) more detail would be useful. This would be my first time trying to do something of that nature, so as much detail as you're willing to give would be very useful. 


Talis Krumins wrote:

Charles Papp wrote:

You will need to loop through the Address_components of the Results and test for Types = "administrative_area_level_1". When you find a match, then you can assign the Long_name or the Short_Name to the target object or variable that you want to use it with.

Is this enough detail to get you unstuck?

Hi Charles,


A little (a lot) more detail would be useful. This would be my first time trying to do something of that nature, so as much detail as you're willing to give would be very useful. 



Never mind, worked it out. Thanks for your help! 

Sorry, I didn't have time yet to reply in more detail, but I'm glad you worked it out. :)