JSON decoder parser error codes
#include <sys/json.h>
typedef enum { JSON_DECODER_PARSE_OK = 0, JSON_DECODER_DOUBLE_QUOTE_EXPECTED = 1, JSON_DECODER_COLON_EXPECTED = 2, JSON_DECODER_RIGHT_BRACE_OR_COMMA_EXPECTED = 3, JSON_DECODER_RIGHT_BRACKET_OR_COMMA_EXPECTED = 4, JSON_DECODER_TRUE_EXPECTED = 5, JSON_DECODER_FALSE_EXPECTED = 6, JSON_DECODER_NULL_EXPECTED = 7, JSON_DECODER_UNEXPECTED_CHARACTER = 8, JSON_DECODER_UNTERMINATED_STRING = 9, JSON_DECODER_INCOMPLETE_ESCAPED_CHARACTER = 10, JSON_DECODER_INVALID_HEXADECIMAL_DIGIT = 11, JSON_DECODER_MISSING_TRAIL_SURROGATE = 12, JSON_DECODER_UNEXPECTED_TRAIL_SURROGATE = 13, JSON_DECODER_UNEXPECTED_COMMA = 14, JSON_DECODER_EXTRA_CHARACTERS = 15, JSON_DECODER_UNEXPECTED_END_OF_STRING = 16 } json_decoder_parse_error_t;
No parsing error occurred.
A " character was expected.
A : character was expected following a property name.
A } or , character was expected.
A ] or , character was expected.
The string true was expected.
The string false was expected.
The string null was expected.
An unexpected character was found.
A string was not terminated by a ".
No further data was found following a \ character.
A character in a \uxxxx sequence is not a hexadecimal digit.
A unicode UTF-16 trailing surrogate was not found following a lead surrogate.
A unicode UTF-16 trailing surrogate was encountered where it is not permitted.
An array or object contained a , with no following element or property.
The JSON string is followed by extra characters or an unterminated comment.
The JSON string ended unexpectedly.
If a call to json_decoder_parse_json_str() fails with a JSON_DECODER_PARSE_ERROR, the specific error and its location may be obtained by calling json_decoder_get_parse_error(), which returns the parser error code.