php json to associative array code example
Example 1: json php
$person = array(
"name" => "KINGASV",
"title" => "CTO"
);
$personJSON=json_encode($person);
$personJSON = '{"name":"KINGASV","title":"CTO"}';
$person = json_decode($personJSON);
echo $person->name;
Example 2: php json string to associative array
$assocArray = json_decode($data, true);
Example 3: parse json phph
echo json_decode("[1,2,3]")[0];
Example 4: php json decoding as string incorrectly
$r=json_decode(stripcslashes(trim($response,'"')));