json_decode()
Декодирует JSON-строку в PHP-значение.
Сигнатура
json_decode(string $json, ?bool $associative = null, int $depth = 512, int $flags = 0): mixedФункция json_decode() разбирает JSON. С $associative = true возвращает ассоциативный массив вместо объекта.
<?php
$data = json_decode('{"x": 1, "y": 2}', true);
print_r($data); // ["x" => 1, "y" => 2]