0

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/

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Amiine Benkeroum
  • 85
  • 1
  • 1
  • 5

1 Answers1

1

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

Try

 data.Response.ResourceSets.ResourceSet.Resources.Location[0].Address.AddressLine["#text"]
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Fouad HAMDI
  • 456
  • 2
  • 4