Amiine Benkeroum
Amiine Benkeroum

Reputation: 85

How can I get Location name from JSON Data

I'm trying to get Location name from a JSON data. I did it with:

 var adsress = JSON.stringify(dataa.Response.ResourceSets.ResourceSet.Resources.Location.Address.AddressLine["#text"]);

but when I changed the location point I can't do the same since it shows:

Cannot get ['#text'] of null or undefined var

The result( JSON data ):

 "Resources":{"Location":[{"Name":{"#text":"Rue Ibnou Battouta, Agadir, Morocco"}

http://jsfiddle.net/hJVjf/

Upvotes: 0

Views: 140

Answers (1)

Fouad HAMDI
Fouad HAMDI

Reputation: 491

data.Response.ResourceSets.ResourceSet.Resources.Location is an array.

Try

 data.Response.ResourceSets.ResourceSet.Resources.Location[0].Address.AddressLine["#text"]

Upvotes: 1

Related Questions