I am trying to get data from an api where the result json has no square brackets, and looks like this
{
"status":1,
"time":42868,
"response":{
"some_item":"itemval1",
"itemstat":"itemstatvalue"
}
}
I'm trying to get an array through json_decode
, but i can't get anywhere I've been trying for hours...
$data = json_decode($result);
by doing such i get the data back in a large string, but whenever i try to access it such as
echo $data->time;
or
echo $data[0];
I get an error saying 500 where my code is invalid, so I'm wondering how I would convert this to an array where i can access these values. Whenever I just echo $data
though i get a ridiculously large string full of all of the values i need, but can't access them.