0

If:

JSON.stringify(data)

Returns:

{"data":{"url":"http://www.google.com"}}

How do I access the url?

I tried

data.url
data[0].url
P.Henderson
  • 1,001
  • 2
  • 13
  • 23

3 Answers3

3

You'll need to parse the data back into a JavaScript object:

JSON.parse(data).data.url;

When in JSON format, it's just a string.

Elliot Bonneville
  • 51,872
  • 23
  • 96
  • 123
0

I think you want data.data.url. Your variable is called data, but your first entry is also called data.

Carlos
  • 117
  • 7
0
data.data.url

your object is called data, it contains an object called data which has a url property.

Evert
  • 8,161
  • 1
  • 15
  • 17