If:
JSON.stringify(data)
Returns:
{"data":{"url":"http://www.google.com"}}
How do I access the url?
I tried
data.url
data[0].url
If:
JSON.stringify(data)
Returns:
{"data":{"url":"http://www.google.com"}}
How do I access the url?
I tried
data.url
data[0].url
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.
I think you want data.data.url
. Your variable is called data, but your first entry is also called data.
data.data.url
your object is called data, it contains an object called data which has a url property.