I am trying to get values from a nested JSON, which contains keys with spaces. I am having this error:
Notice: Trying to get property 'Submit Date' of non-object in json.php on line 47
Notice: Trying to get property 'Entry ID' of non-object in json.php on line 46
{ "entries": [ { "values": { "Entry ID": "INC000000001", "Submitter": "Remedy Application Service", "Assigned Group": "TI WIN", "Priority": "Medium", "Submit Date": "2022-07-20T22:27:01.000+0000", "Assignee": "Example asignee" }, "_links": { } } ] }
My PHP Code
<?php
$response = curl_exec($curl);
$data = json_decode($response);
foreach($data->entries as $entr)
{
foreach($entr->values as $valores)
{
$entry_id=$valores->{'Entry ID'};
$submit_date=$valores->{'Submit Date'};
}
}
?>
print_r output:
Array
(
[entries] => Array
(
[0] => Array
(
[values] => Array
(
[Entry ID] => INC000000001
[Submitter] => Remedy Application Service
[Assigned Group] => TI WIN
[Priority] => Medium
[Submit Date] => 2022-07-20T22:27:01.000+0000
[Assignee] => Example asignee
)
)
)
)
Where is the error?
any method to get the values?