PHP JSON_DECODE
$personJSON = '{"name":"Johny Carson","title":"CTO"}';
$person = json_decode($personJSON);
echo $person->name; // Johny Carson
Grepper
$personJSON = '{"name":"Johny Carson","title":"CTO"}';
$person = json_decode($personJSON);
echo $person->name; // Johny Carson
header('Content-type: application/json');
echo json_encode($array);
header('Content-Type: application/json');
$colors = array("red","blue","green");
echo json_encode($colors);
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
echo $data;
$data = json_decode($json);
$json = '
{
"type": "donut",
"name": "Cake",
"toppings": [
{ "id": "5002", "type": "Glazed" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5004", "type": "Maple" }
]
}';
$yummy = json_decode($json, true);
echo $yummy['toppings'][2]['type']; //Maple