Resolve PHP json decode error

From LemonWiki共筆
Revision as of 14:34, 12 April 2019 by Planetoid (talk | contribs) (Created page with " == Syntax error, malformed JSON == Possible causes * the input is empty or multiple white spaces * the input contains Byte order mark (BOM)<ref>[https://blog.longwin.com....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Syntax error, malformed JSON

Possible causes

Solution:

Unexpected control character found

Possible causes

Solution:

  • Remove control character
$replacement = '';
preg_replace('/[\x00-\x1F]/', $replacement, $input);

References

Relates articles