JSON_DECODE - get values from multidimensional array stdClass
How can I get the specific value from multidimensional array with stdClass object using json_decode ? For example, when I use $array['users'][16] in regular array, I will get the value for user with ID 16. How can I do this in case of JSON ?
Hi,
You can get the values from stdClass Object multidimensional array in a similar way, than in case of standard array. What you need to do, is include true parameter into json_decode function.
For example:
$json_array = '{"users":{"10":"Abc", "16":"Abcde"}}';
$array = json_decode($json_array, true);
echo $array['users'][16];
1 answer