Answers for "how to retrieve json object in php"

PHP
1

php access json object

<?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
?>
Posted by: Guest on April-15-2020
5

php return json

header('Content-type: application/json');
echo json_encode($array);
Posted by: Guest on March-20-2020

Code answers related to "how to retrieve json object in php"

Browse Popular Code Answers by Language