Skip to content

Instantly share code, notes, and snippets.

@xatest
Created August 25, 2012 07:55
Show Gist options
  • Save xatest/3462292 to your computer and use it in GitHub Desktop.
Save xatest/3462292 to your computer and use it in GitHub Desktop.
JSON to PHP Array
<?php
$testjson = '{"data":[{"articles":[{"content":"Hi, aaa","image":["http://www.weedo.hk/resouces/aaa_0.png","http://www.weedo.hk/resouces/aaa_1.png","http://www.weedo.hk/resouces/aaa_2.png"],"thumbnail":"http://www.weedo.hk/resouces/aaa_thumb.png","title":"aaa"},{"content":"Hi, bbb","image":["http://www.weedo.hk/resouces/bbb_0.png","http://www.weedo.hk/resouces/bbb_1.png","http://www.weedo.hk/resouces/bbb_2.png"],"thumbnail":"http://www.weedo.hk/resouces/bbb_thumb.png","title":"bbb"}],"image":"http://www.weedo.hk/resouces/xxxx.png","title":"xxxx","type":"features"},{"articles":[{"appName":"Cute Weather","appURL":"http://itunes.apple.com/cn/app/ke-ai-tian-qi/id524058480?mt=8","content":"Hi, aaa","icon":"http://www.weedo.hk/resouces/aaa_icon.png","image":["http://www.weedo.hk/resouces/aaa_0.png","http://www.weedo.hk/resouces/aaa_1.png","http://www.weedo.hk/resouces/aaa_2.png"],"thumbnail":"http://www.weedo.hk/resouces/aaa_thumb.png","title":"aaa"},{"appName":"Cute Weather","appURL":"http://itunes.apple.com/cn/app/ke-ai-tian-qi/id524058480?mt=8","content":"Hi, bbb","icon":"http://www.weedo.hk/resouces/bbb_icon.png","image":["http://www.weedo.hk/resouces/bbb_0.png","http://www.weedo.hk/resouces/bbb_1.png","http://www.weedo.hk/resouces/bbb_2.png"],"thumbnail":"http://www.weedo.hk/resouces/bbb_thumb.png","title":"bbb"}],"image":"http://www.weedo.hk/resouces/xxxx.png","title":"xxxx","type":"APP"}]}';
var_dump(json_decode($testjson, true));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment