14 return (json_last_error() == JSON_ERROR_NONE);
23 switch (json_last_error()) {
27 case JSON_ERROR_DEPTH:
28 $error =
'The maximum stack depth has been exceeded.';
30 case JSON_ERROR_STATE_MISMATCH:
31 $error =
'Invalid or malformed JSON.';
33 case JSON_ERROR_CTRL_CHAR:
34 $error =
'Control character error, possibly incorrectly encoded.';
36 case JSON_ERROR_SYNTAX:
37 $error =
'Syntax error, malformed JSON.';
41 $error =
'Malformed UTF-8 characters, possibly incorrectly encoded.';
44 case JSON_ERROR_RECURSION:
45 $error =
'One or more recursive references in the value to be encoded.';
48 case JSON_ERROR_INF_OR_NAN:
49 $error =
'One or more NAN or INF values in the value to be encoded.';
51 case JSON_ERROR_UNSUPPORTED_TYPE:
52 $error =
'A value of a type that cannot be encoded was given.';
55 $error =
'Unknown JSON error occured.';