Question : php json_decode
Answered by : code-grepper
$personJSON = '{"name":"Johny Carson","title":"CTO"}';
$person = json_decode($personJSON);
echo $person->name; // Johny Carson
Source : | Last Update : Mon, 08 Jul 19
Question : json url decode php
Answered by : upset-unicorn-ajcntu02oiwf
$json = file_get_contents('http://api.geonames.org/findNearbyPlaceNameJSON?lat=51.9877644&lng=-1.47866&username=demo');
$data = json_decode($json,true);
$Geonames = $data['geonames'][0];
echo "<pre>";
print_r($Geonames);
exit;
Source : | Last Update : Wed, 01 Dec 21
Question : json decode php array
Answered by : fierce-fly-1upc7lzzu243
<?php $json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373"); $data = json_decode($json); if (count($data->stand)) { // Open the table echo "<table>"; // Cycle through the array foreach ($data->stand as $idx => $stand) { // Output a row echo "<tr>"; echo "<td>$stand->afko</td>"; echo "<td>$stand->positie</td>"; echo "</tr>"; } // Close the table echo "</table>"; }
?>
Source : https://stackoverflow.com/questions/26213049/how-can-i-parse-json-into-a-html-table-using-php | Last Update : Sun, 17 Apr 22
Question : json encode decode php
Answered by : armando-flores
$json = '{"a":1,"b":2,"c":3}';
var_dump(json_decode($json)); //converts json to array
$array = [ "a" => 1, "b" => 2, "c" => 3];
echo json_encode($json_encode($json)); //converts array to json
Source : | Last Update : Thu, 14 Apr 22
Question : php decode json object
Answered by : nuno-silva
<?php
$json = '{"firstName":"Peter","lastName:":"Silva","age":23}';
$personInfo = json_decode(json);
echo $personInfo->age;
?>
Source : | Last Update : Thu, 29 Oct 20
Question : php try to decode json
Answered by : revaz-gh
/** Checks if JSON and returns decoded as an array, if not, returns false,
but you can pass the second parameter true, if you need to return
a string in case it's not JSON */
function tryJsonDecode($string, $returnString = false) { $arr = json_decode($string); if (json_last_error() === JSON_ERROR_NONE) { return $arr; } else { return ($returnString) ? $string : false; }
}
Source : | Last Update : Fri, 06 Aug 21