I am trying to figure out how to use the data in Yelp API v2 . How do you read the data given by yelp after you json.stringify it. This is what I did,
var output = JSON.stringify(data);
alert(output[0].id) // This comes out to be undefined.
How do you read the json data from yelp api?
data
should already be an object. alert(data[0].id)
. If you're grabbing it from $.ajax
, which I assume, it will return an object.
If data
is a string, then you want:
var output = JSON.parse(data);
alert(output[0].id)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.