How to debug JSON errors in PHP

1 Answer

0 votes
$json_string = json_encode("{'Abcd': \xF2}");

if (json_last_error() != JSON_ERROR_NONE) 
    printf("%s", json_last_error_msg());

 
 
/*
run: 
  
Malformed UTF-8 characters, possibly incorrectly encoded
  
*/  

 



answered Sep 4, 2017 by avibootz

Related questions

1 answer 302 views
1 answer 256 views
256 views asked Nov 25, 2017 by avibootz
1 answer 263 views
263 views asked Apr 14, 2016 by avibootz
2 answers 381 views
...