Skip to main content

Name

json.strerror — Return the description of a JSON error code

Synopsis

require("json");

json.strerror(code);

code: numeric

Description

This function returns a description of the JSON error code returned when json.decode fails.

str = json.strerror(code);

The follow constants are defined and can be used to determine the cause of failure in certain JSON operations; you may pass any of these to json.strerror to obtain a description:

  • json.ERROR_DEPTH

  • json.ERROR_PARSE_EOF

  • json.ERROR_PARSE_UNEXPECTED

  • json.ERROR_PARSE_NULL

  • json.ERROR_PARSE_BOOLEAN

  • json.ERROR_PARSE_NUMBER

  • json.ERROR_PARSE_ARRAY

  • json.ERROR_PARSE_OBJECT_KEY_NAME

  • json.ERROR_PARSE_OBJECT_KEY_SEP

  • json.ERROR_PARSE_OBJECT_VALUE_SEP

  • json.ERROR_PARSE_STRING

  • json.ERROR_PARSE_COMMENT

See Also

Was this page helpful?