Answers for "read json file php"

PHP
3

read json file data using php

$filedata = file_get_contents('filename.json');
$details = json_decode($filedata);
print_r($details);
Posted by: Guest on July-19-2021
19

php json_decode

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

$person = json_decode($personJSON);

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

open json file php

// Get the contents of the JSON file 
$strJsonFileContents = file_get_contents("css-color-names.json");
var_dump($strJsonFileContents); // show contentsCopy
Posted by: Guest on June-19-2021
7

php decode json file

$json = json_decode(file_get_contents('/path/to/your/file.json'));
Posted by: Guest on March-15-2020
2

access json with php

<?php

$data = '{
	"name": "Aragorn",
	"race": "Human"
}';

$character = json_decode($data);
echo $character->name;
Posted by: Guest on August-20-2020
0

convert text file to json php

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

Browse Popular Code Answers by Language