The json_decode function takes a string of JSON and returns a PHP object.

Note: it is possible to have a string that is valid JavaScript but not valid JSON. If the name and value aren't enclosed in double quotes, the name isn't enclosed in double quotes or there is a trailing comma, json_decode() will return null.

    
    $json = '{"foo-bar": 12345}';

    $obj = json_decode($json);

    echo $obj->{'foo-bar'};
    // 12345