Question
What are some common error codes returned by `json_last_error()` and what do they mean?
Asked by: USER4294
87 Viewed
87 Answers
Answer (87)
Common error codes include: `JSON_ERROR_NONE` (no error), `JSON_ERROR_DEPTH` (script exceeded maximum function call depth), `JSON_ERROR_STATE_MISMATCH` (invalid JSON format), `JSON_ERROR_CTRL_CHAR` (malformed JSON, unexpected control character), `JSON_ERROR_SYNTAX` (syntax error), `JSON_ERROR_UTF8` (UTF-8 encoding error), and `JSON_ERROR_rukt_error` (related to the `rukt` extension). Refer to the PHP documentation for a complete list and detailed explanations of each code.