我试图从json_encode,json_decode,数组?
{
"data": [{
"media_count": 3045,
"name": "snow",
},
{
"media_count": 79,
"name": "snowman",
},
{
"media_count": 40,
"name": "snowday",
},
{
"media_count": 29,
"name": "snowy",
}]
}
进入刚刚data
我一直很努力,使用:
$obj = json_decode($res[0], true);
echo $obj['data']; //this returns an array
我也试过这样:
$obj = json_encode($res[0], true);
echo $obj; // this returns json, but not inside `data`
"data": [{
"media_count":54373,
"name":"test"
}]
我只是想进入data
。我会怎么做?
在此先感谢!
UPDATE:对不起提了,我想这个JSON格式请
最后,我想只能看到
{
"media_count":54373,
"name":"test"
}
喜欢的东西thiat
顺便说一句,你原来的JSON,因为它的立场,是无效的,由于尾随逗号。 – xbonez