I\'m building a PHP script that feeds JSON data to another script. My script builds data into a large associative array, and then outputs the data using json_encode
json_encode
best way to format JSON data is like this!
header('Content-type: application/json; charset=UTF-8'); echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
Replace $response with your Data which is required to be converted to JSON