<?php
$product = array(
'id' => 'p01',
'name' => 'name 1',
'price' => 4.5
);
header('Content-Type: application/json');
echo json_encode($product);
?>
Output
{"id":"p01","name":"name 1","price":4.5}
<?php
$product = array(
'id' => 'p01',
'name' => 'name 1',
'price' => 4.5
);
header('Content-Type: application/json');
echo json_encode($product);
?>
{"id":"p01","name":"name 1","price":4.5}