JSON and Data Shapes
Nested JSON
Nested JSON data is read one level at a time.
Nested JSON
nested_json.php
<?php
$status = ;
$json = '{"user":{"name":"Ada","status":"' . $status . '"}}';
$userStatus = json_decode($json, true)["user"]["status"];
$enabled = $userStatus === "active" ? "yes" : "no";
echo "status=" . $status . "\n";
echo "enabled=" . $enabled . "\n";
<?php
$status = ;
$json = '{"user":{"name":"Ada","status":"' . $status . '"}}';
$userStatus = json_decode($json, true)["user"]["status"];
$enabled = $userStatus === "active" ? "yes" : "no";
echo "status=" . $status . "\n";
echo "enabled=" . $enabled . "\n";
<?php
$status = ;
$json = '{"user":{"name":"Ada","status":"' . $status . '"}}';
$userStatus = json_decode($json, true)["user"]["status"];
$enabled = $userStatus === "active" ? "yes" : "no";
echo "status=" . $status . "\n";
echo "enabled=" . $enabled . "\n";
nested field
Select the nested scalar that matters for the current decision.