clankill3r Posted June 2, 2011 Share Posted June 2, 2011 hi, when i print my decoded json i get this: (i only show [0], there are 9 more....) Array ( [0] => stdClass Object ( [id_str] => 75875410356862976 [in_reply_to_status_id] => [user] => stdClass Object ( [id_str] => 119706155 [follow_request_sent] => [verified] => [profile_text_color] => 634047 [protected] => [profile_sidebar_fill_color] => E3E2DE [name] => M van Toorenburg [notifications] => [profile_background_tile] => [favourites_count] => 1 [profile_image_url] => http://a0.twimg.com/profile_images/731805722/toorenburg_k_normal.jpg [utc_offset] => 3600 [location] => Den Haag [default_profile] => [listed_count] => 119 [profile_link_color] => 088253 [description] => Madeleine van Toorenburg, kamerlid voor het CDA [screen_name] => MvanToorenburg [lang] => en [profile_sidebar_border_color] => D3D2CF => [time_zone] => Amsterdam [show_all_inline_media] => [contributors_enabled] => [geo_enabled] => [profile_use_background_image] => 1 [created_at] => Thu Mar 04 11:58:09 +0000 2010 [followers_count] => 1013 [id] => 119706155 [default_profile_image] => [profile_background_color] => EDECE9 [profile_background_image_url] => http://a1.twimg.com/images/themes/theme3/bg.gif [friends_count] => 116 [is_translator] => [statuses_count] => 349 [following] => ) [text] => Afdracht aan goede doelen stevig in vergunningsvoorwaarden. Ook hierover komt Teeven terug naar de Kamer. [in_reply_to_user_id] => [retweet_count] => 0 [place] => [favorited] => [in_reply_to_status_id_str] => [id] => 7.58754103569E+16 [created_at] => Wed Jun 01 10:44:42 +0000 2011 [in_reply_to_screen_name] => [truncated] => [source] => Twitter for iPhone [in_reply_to_user_id_str] => [contributors] => [coordinates] => [geo] => [retweeted] => ) [1] => stdClass Object ( [id_str] => 75870733334609921 [in_reply_to_status_id] => [user] => stdClass Object ( [id_str] => 119706155 [follow_request_sent] => [verified] => [profile_text_color] => 634047 [protected] => [profile_sidebar_fill_color] => E3E2DE [name] => M van Toorenburg [notifications] => [profile_background_tile] => [favourites_count] => 1 [profile_image_url] => http://a0.twimg.com/profile_images/731805722/toorenburg_k_normal.jpg [utc_offset] => 3600 [location] => Den Haag [default_profile] => [listed_count] => 119 [profile_link_color] => 088253 [description] => Madeleine van Toorenburg, kamerlid voor het CDA [screen_name] => MvanToorenburg [lang] => en [profile_sidebar_border_color] => D3D2CF => [time_zone] => Amsterdam [show_all_inline_media] => [contributors_enabled] => [geo_enabled] => [profile_use_background_image] => 1 [created_at] => Thu Mar 04 11:58:09 +0000 2010 [followers_count] => 1013 [id] => 119706155 [default_profile_image] => [profile_background_color] => EDECE9 [profile_background_image_url] => http://a1.twimg.com/images/themes/theme3/bg.gif [friends_count] => 116 [is_translator] => [statuses_count] => 349 [following] => ) [text] => Nu nog meer zekerheden voor goede doelen binnenslepen! [in_reply_to_user_id] => [retweet_count] => 0 [place] => [favorited] => [in_reply_to_status_id_str] => [id] => 7.58707333346E+16 [created_at] => Wed Jun 01 10:26:07 +0000 2011 [in_reply_to_screen_name] => [truncated] => [source] => Twitter for iPhone [in_reply_to_user_id_str] => [contributors] => [coordinates] => [geo] => [retweeted] => ) can i get [location] => Den Haag for example to store that? Quote Link to comment https://forums.phpfreaks.com/topic/238261-can-i-get-those-json-elements/ Share on other sites More sharing options...
sKunKbad Posted June 2, 2011 Share Posted June 2, 2011 The decoded array shows that o is a stdClass Object, and the same is true for user. <?php $array = json_decode( $the_json ); // You should be able to get the location with something like this: echo $array['o']->user->location; Quote Link to comment https://forums.phpfreaks.com/topic/238261-can-i-get-those-json-elements/#findComment-1224412 Share on other sites More sharing options...
clankill3r Posted June 3, 2011 Author Share Posted June 3, 2011 thanks, apart from the quite's ['0'] your right. Quote Link to comment https://forums.phpfreaks.com/topic/238261-can-i-get-those-json-elements/#findComment-1224545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.