- json_decode: documentation ( source)
- print_r: documentation ( source)
<?php
// the name and value must be enclosed in double quotes
// single quotes are not valid
$bad_json = "{ 'bar': 'baz' }";
echo "BAD:";
print_r(json_decode($bad_json)); // null
$good_json = '{"foo-bar": 12345}';
echo "\nGOOD:";
print_r(json_decode($good_json));