php load json code example
Example 1: php decode json file
$json = json_decode(file_get_contents('/path/to/your/file.json'));
Example 2: php access json object
<?php
$someJSON = '[{"name":"Jonathan Suh","gender":"male"},{"name":"William Philbin","gender":"male"},{"name":"Allison McKinnery","gender":"female"}]';
$someObject = json_decode($someJSON);
echo $someObject[0]->name;
?>
Example 3: access json with php
<?php
$data = '{
"name": "Aragorn",
"race": "Human"
}';
$character = json_decode($data);
echo $character->name;
Example 4: parse json phph
echo json_decode("[1,2,3]")[0];