PHPJSONjson_decode

Decodes a JSON string.

Syntax

json_decode(string $json, ?bool $associative): mixed

Example

Enter values below to update the example in real time.

data
json_decode
echo
Alice
$json = '{"name":"Alice","age":30}';
$data = json_decode($json, true);
echo $data["name"]; // Alice