Question : php access json object
Answered by : francesco-bussolino
<?php // JSON string $someJSON = '[{"name":"Jonathan Suh","gender":"male"},{"name":"William Philbin","gender":"male"},{"name":"Allison McKinnery","gender":"female"}]'; // Convert JSON string to Object $someObject = json_decode($someJSON); echo $someObject[0]->name; // Access Object data
?>
Source : https://jonsuh.com/blog/convert-loop-through-json-php-javascript-arrays-objects/ | Last Update : Wed, 22 Apr 20
Question : accessing json data in php
Answered by : borma425
$json = '
{ "type": "donut", "name": "Cake"
}';
$yummy = json_decode($json);
echo $yummy->type; //donut
Source : https://stackoverflow.com/questions/29308898/how-do-i-extract-data-from-json-with-php | Last Update : Tue, 19 Oct 21
Question : access json with php
Answered by : better-bison-7ur2i4n3weko
<?php
$data = '{ "name": "Aragorn", "race": "Human"
}';
$character = json_decode($data);
echo $character->name;
Source : https://www.taniarascia.com/how-to-use-json-data-with-php-or-javascript/ | Last Update : Thu, 27 Aug 20
Question : Returning JSON from a PHP Script
Answered by : long-locust-6bchlrhsm70y
<?php
$data = /** whatever you're serializing **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
Source : https://stackoverflow.com/questions/4064444/returning-json-from-a-php-script | Last Update : Thu, 25 Nov 21