“json encode decode php” Kode Jawaban

php json_decode

$personJSON = '{"name":"Johny Carson","title":"CTO"}';

$person = json_decode($personJSON);

echo $person->name; // Johny Carson
Grepper

php mendekode file json

$json = json_decode(file_get_contents('/path/to/your/file.json'));
Kaotik

JSON URL Decode PHP

$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;
Upset Unicorn

json encode decode php

$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
Armandres

php mendekode objek json

<?php

$json = '{"firstName":"Peter","lastName:":"Silva","age":23}';

$personInfo = json_decode(json);

echo $personInfo->age;

?>
Apollo

Jawaban yang mirip dengan “json encode decode php”

Pertanyaan yang mirip dengan “json encode decode php”

Lebih banyak jawaban terkait untuk “json encode decode php” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya