Answers for "HOW TO READ JSON FROM APPLICATION/JSON CALL 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
1

return json in php

//code igniter
$query="qry";
$query = $this->db->query($query);
$res=$query->result();
return json_encode($res);
Posted by: Guest on September-24-2020

Browse Popular Code Answers by Language