Answers for "turn plain text into json resposne php"

PHP
19

php parse json

$personJSON = '{"name":"Johny Carson","title":"CTO"}';

$person = json_decode($personJSON);

echo $person->name; // Johny Carson
Posted by: Guest on July-01-2019
0

convert text file to json php

<?php
  header('Content-type: application/json');
  echo json_encode( explode("rn",file_get_contents('data.txt')) );
?>
Posted by: Guest on November-04-2020

Browse Popular Code Answers by Language