Php returns NULL using json_decode. Php5.2 and later comes with the json_decode function, but the format requirements for json text strings are very strict. It is very likely that the return value obtained by using this function is NULL. after returning php5.2 obtained by using the json_last_error () function, the json_decode function is provided, but the format of json text strings is very strict.
It is very likely that the return value obtained by using this function is NULL.
The return value obtained using the json_last_error () function is JSON_ERROR_SYNTAX (Syntax error ).
You can troubleshoot the error in the following ways.
1. json strings must contain double quotation marks
$ Output = str_replace ("'",' "', $ output );
2. the json string must be UTF-8 encoded.
$ Output = iconv ('gbk', 'utf8', $ output );
3. there cannot be redundant commas, for example, [,]
Replace with regular expressions, preg_replace ('/, \ s * ([\]}])/M',' $ 1', $ output)
Bytes. It is very likely that the return value obtained by using this function is NULL. The return value obtained by using the json_last_error () function...