Consider j.json file that its content is following valid json:
{
"t": "\\"
}
PHP json_encode can not pars it:
$r=json_decode(file_get_contents('j.json'));
var_dump($r); //returns null
note: The question is cleaned up, the problem is same.
Unfortunately
json_decodeis implemented incorrectly and may return null when get some valid json file or may modify their values, you can use following function that can decode all valid json strings: