如何从包含子数组的json数组中选择数据并显示


how to select data and display it from json array which contains sub arrays?

这是我的json编码数据

echo json_encode($something) 

从mongodb数据库给我的

[
    {
        "_id":{ "$id":"535f6dc8b8082fd3f80dea0f"},
        "val":"mukund",
        "value":"Lost in the woods"
    }
]

我只需要从该数组中获取变量$id、$name、$Text 的535f6dc8b8082fd3f80dea0fmukundLost in the woods

请帮助

尝试json_decode()

$j = '[{"_id":{"$id":"535f6dc8b8082fd3f80dea0f"},"val":"mukund","value":"Lost in the woods"}]';
$r = json_decode($j);
 echo (string)$r[0]->_id->{'$id'}; //535f6dc8b8082fd3f80dea0f
 echo $r[0]->val; //mukund
 echo $r[0]->value; //Lost in the woods