Resolve PHP json decode error

From LemonWiki共筆
Jump to navigation Jump to search

Syntax error, malformed JSON

Possible causes

Solution:

Unexpected control character found

Possible causes

Solution:

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

References

Relates articles