$json = $_POST['data']; //json need to be data
$info = json_encode($json);
$file = fopen('test.json','w+') or die("File not found");
fwrite($file, $info);
fclose($file);
exit;
file_put_contents('test.json', json_encode($_POST['data']));
exit;