It can be done with json_decode()
, be sure to set the second argument to true
because you want an array rather than an object.
$array = json_decode($json, true); // decode json
Outputs:
Array
(
[id] => 1
[name] => foo
[email] => [email protected]
)