Resolve PHP json decode error: Difference between revisions

Jump to navigation Jump to search
m
Line 4: Line 4:
* the input is empty entirely or multiple white spaces
* the input is empty entirely or multiple white spaces
* the input contains [[Byte order mark]] (BOM)<ref>[https://blog.longwin.com.tw/2013/11/php-json_decode-null-fix-2013/ PHP json_decode() 傳回 NULL 的解法 | Tsung's Blog]</ref>
* the input contains [[Byte order mark]] (BOM)<ref>[https://blog.longwin.com.tw/2013/11/php-json_decode-null-fix-2013/ PHP json_decode() 傳回 NULL 的解法 | Tsung's Blog]</ref>
* Use {{kbd | key=<nowiki>'</nowiki>}} instead of {{kbd | key=<nowiki>"</nowiki>}} for quotation


Solution:
Solution:
* Not allowed empty input
* Not allowed empty input
* Remove [[Byte order mark]] (BOM)
* Remove [[Byte order mark]] (BOM)
* Use {{kbd | key=<nowiki>"</nowiki>}} for quotation
* Use [https://jsonlint.com/ JSONLint - The JSON Validator] to validate the JSON format
* Use [https://jsonlint.com/ JSONLint - The JSON Validator] to validate the JSON format


Navigation menu