1

Lets say I have a URL that brings out this JSON object.

How do I fetch Albertson?

{
  "ancestor" : [
    {
      "father" : [
         {
           "long_name" : "Albertson",
           "short_name" : "Roger",
           "types" : [ "surname" ]
         }
       ]
     }
  ],
}

Is it ancestor[0][0].long_name?

3
  • obj.ancestor[0].father[0].long_name Commented Aug 7, 2014 at 9:36
  • 1
    "Is it ...?" Did you try? Commented Aug 7, 2014 at 10:27
  • I am working with PHP Commented Aug 10, 2014 at 19:39

1 Answer 1

1

You can fetch the data using

object.ancestor[0].father[0].long_name

You can also refer: http://www.json.com/#object-with-nested-array-and-object

Sign up to request clarification or add additional context in comments.

2 Comments

So how can i get the country from this json ? maps.googleapis.com/maps/api/geocode/…
Just try this you will get the country from json data object.results[0].address_components[5].types[0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.