convert form input to json php code example
Example 1: how to receive json data in php
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
echo $data;
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')) );
?>