I'm having an issue reading my JSON file using PHP. I've tried a couple of things, but it seems I am unable to actually read the data. What would be the best way of achieving such thing? I have included a sample of my JSON data below:
{
"UNIQUE ID":{
"data":"123",
"more_data":"456"
},
"UNIQUE ID":{
"data":"789",
"more_data":"123"
}
}
My current PHP file looks like:
<?php
$json = file_get_contents("./data/example.json");
$data = json_decode($json, true);
foreach($data as $single) {
echo $single['UNIQUE ID'][0]['data'];
}
?>
I receive no errors, it just does not show any data. A var_dump($data)
does show it loads the JSON correctly.