shedokan Posted August 20, 2008 Share Posted August 20, 2008 I have this JSON feed: {"generated": "2008-08-19T12:30:33.000217", "games": [{"rating": "Everyone", "updated": "2008-08-18", "popularity": null, "description": "Mitten is avoiding arrows that fall out of the sky! Why are there arrows falling out of the sky? Heck knows :S ( Wait until Mitten 5 is released, and maybe you'll live long enough to find out )\r\nDon't worry, Mitten never gets really badly hurt - luck of the Irish 'n all", "key_mappings": "", "height": 700, "game_url": "http://minaturecookie.deviantart.com/art/Mitten-94306548", "slug": "mixel", "tags": ["cat", "mitten", "arrows", "falling", "avoid", "time", "score", "beat", "addictive", "awesome", "cool", "game"], "instructions": "Use the arrow keys to avoid the falling arrows, and the up arrow to jump the mad man carrying arrows he found on the floor.\r\nTry and get the biggest score you can! But most of all, have fun! ", "uuid": "2f077861-d218-32bf-867d-fdf1fa25a85d", "author": "MinatureCookie", "control_scheme": "{\"fire\": \"na\", \"jump\": \"up\", \"movement\": \"arrow\"}", "author_link": "http://mochiads.com/community/profile/MinatureCookie", "feed_approval_created": "2008-08-18T15:32:24.132976-08:00", "name": "Mitten", "swf_url": "http://games.mochiads.com/c/g/mixel/Mitten.swf", "recommended": false, "thumbnail_url": "http://cdn.mochiads.com/c/g/mixel/_thumb_100x100.png", "created": "2008-08-18T11:47:22.784729-08:00", "categories": ["Action", "Other"], "game_tag": "065c18c7ff0e8671", "leaderboard_enabled": true, "zip_url": "http://cdn.mochiads.com/c/g/mixel.zip", "width": 400}]} which I'm trying to make all those variables php variables, what is the best way to do this? thanks. Link to comment https://forums.phpfreaks.com/topic/120458-importing-json-feed/ Share on other sites More sharing options...
vbnullchar Posted August 20, 2008 Share Posted August 20, 2008 <?php $obj = json_decode($json_feed); echo $obj->generated; ?> Link to comment https://forums.phpfreaks.com/topic/120458-importing-json-feed/#findComment-620699 Share on other sites More sharing options...
shedokan Posted August 20, 2008 Author Share Posted August 20, 2008 thanks, so it makes it like a regular array? Link to comment https://forums.phpfreaks.com/topic/120458-importing-json-feed/#findComment-621009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.