- json_decode: documentation ( source)
- print_r: documentation ( source)
<?php
$getfile='{
"playlist": [
{
"title": "Test title",
"title_bg": "link/to/image.png",
"link": "https://www.google.com",
"description": "This is a test JSON Object"
}
]
}';
$jsonfile = json_decode($getfile);
print_r($jsonfile);?>
<table align="center">
<tr>
<th>Title</th>
<th>Background Image</th>
<th>Video URL (Link to Video)</th>
<th>Description of Video</th>
</tr>
<tr>
<?php
foreach ($jsonfile->playlist as $obj) {
echo '<td>' . $obj->title . '</td>';
echo '<td>' . $obj->title_bg . '</td>';
echo '<td>' . $obj->link . '</td>';
echo '<td>' . $obj->description . '</td>';
}
?>
</tr>
</table>