So, im trying to display the images that are in my JSON file on my website by calling the json file into my php but i get this notice "Array to string conversion". Any ideas on how i should solve this problem?
JSON
[
{
"name" : "match numbers 1",
"template" : "matching",
"data" : [
[
"one",
"Images/Number1.jpg"
],
[
"four",
"Images/Number4.jpg"
],
[
"nine",
"Images/Number9.jpg"
]
]
},
{
"name" : "match numbers 2",
"template" : "matching",
"data" : [
[
"six",
"Images/Number6.jpg"
],
[
"eight",
"Images/Number8.jpg"
],
[
"nine",
"Images/Number9.jpg"
]
]
}
]
php code
<?php
$json_var = file_get_contents("template.json");
$json_var = json_decode($json_var, true);
foreach($json_var as $value)
{
printf($value["name"]);
printf($value["template"]);
printf('<img src="'.$value["data"].'" />');
}
?>