I am trying to parse a string in JSON, but not sure how to go about this. This is an example of the string I am trying to parse into a PHP array.
$json = '{"id":1,"name":"foo","email":"foo@test.com"}';
Is there some library that can take the id, name, and email and put it into an array?
It can be done with
json_decode(), be sure to set the second argument totruebecause you want an array rather than an object.Outputs: