Tengo este codigo php en json:
<?php
header('Content-type: application/json');?>{"br":[<?php
$response = json_decode(file_get_contents('https://fortnitecontent-website-prod07.ol.epicgames.com/content/api/pages/fortnite-game?lang=it'), true);
/*var_dump($response);*/
$count = count($response['battleroyalenews']['news']['motds']);
$else = false;
$data = $response['battleroyalenews']['news']['motds'];
for($i = 0; $i < $count; $i++) {
$signature = current($data);
echo '{"image":"';
echo $data[$i]['image'] . '","title":"';
echo $data[$i]['title'] . '","body":"';
echo $data[$i]['body'] . '"},';
next($response);
}
// Function to convert array into JSON
echo '{}]}';
?>
y cuando lo quito no me genera el codigo json :(
Aquí dejo una vista previa: https://todocodigos.000webhostapp.com/aesFortnite/a.php