Jump to content

Loop through JSON results.


smithmr8

Recommended Posts

Hi,

 

I'd like to be able to loop through a JSON object like the one below in Javascript (via jQuery if applicable).

 

{"completed_in":0.117,"max_id":146692852720746500,"max_id_str":"146692852720746496","next_page":"?page=2&max_id=146692852720746496&q=Luke&lang=en&rpp=2","page":1,"query":"Luke","refresh_url":"?since_id=146692852720746496&q=Luke&lang=en","results":[{"created_at":"Tue, 13 Dec 2011 20:47:56 +0000","from_user":"Santo4osu","from_user_id":283539563,"from_user_id_str":"283539563","from_user_name":"Gregg Santomieri","geo":null,"id":146692852720746500,"id_str":"146692852720746496","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http://a2.twimg.com/profile_images/1585743932/image_normal.jpg","source":"<a href="http://twitter.com/">web</a>","text":"RT @CFBLive: #OhioState HC Urban Meyer said Luke Fickell will make the defensive calls in 2012 & have defensive coordinator in his title","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null},{"created_at":"Tue, 13 Dec 2011 20:47:49 +0000","from_user":"BertieBertGLove","from_user_id":332798835,"from_user_id_str":"332798835","from_user_name":"Bertie Gilbert Fans ","geo":null,"id":146692826044973060,"id_str":"146692826044973057","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http://a3.twimg.com/profile_images/1647366588/bbgl2__2__normal.jpg","source":"<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>","text":"RT @Bertwg97: Guys I got mugged ages ago. I was just commenting on luke's tweet.","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}],"results_per_page":2,"since_id":0,"since_id_str":"0"}

 

It's the "result" array or object that I need to loop through to get access to the information inside each result object. How would I achieve this ?

 

Thanks,

Luke.

Link to comment
https://forums.phpfreaks.com/topic/253114-loop-through-json-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.