make json array of specfic object in php code example
Example 1: php return json
header('Content-type: application/json');
echo json_encode($array);
Example 2: convert text file to json php
<?php
header('Content-type: application/json');
echo json_encode( explode("\r\n",file_get_contents('data.txt')) );
?>