[PHP] Decode JSON objects as associative arrays

Created on November 30, 2026

Pass true as the second argument to json_decode to return JSON objects as PHP associative arrays.

<?php

$raw_json = '{"name":"Taro"}';
$user = json_decode($raw_json, true);

echo $user["name"];

Output

Taro
PHP