I have a JSON array with multiple objects and trying to use json_decode
to make an associate array.
Sample data
$json='[{
type: "cool",
category: "power",
name: "Robert Downey Jr.",
character: "Tony Stark / Iron Man",
bio: "cool kid"
},
{
type: "cool",
category: "power",
name: "Chris Hemsworth",
character: "Thor",
bio: "cool kid"
},
{
type: "NotCool",
category: "nothing",
name: "Alexis Denisof",
character: "The Other",
bio: "cool kid"
}]';
Here's what I am doing:
$data = json_decode($json, true);
which gives me a NULL
result. What am I doing wrong?
(I'm new to PHP.)