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 207 views
1 answer 182 views
182 views asked Nov 25, 2017 by avibootz
1 answer 183 views
183 views asked Apr 14, 2016 by avibootz
2 answers 278 views
...