json_decoder_error_t

JSON decoder error codes

Synopsis:

#include <sys/json.h>
typedef enum {
    JSON_DECODER_OK = 0,
    JSON_DECODER_NO_MEMORY = 1,
    JSON_DECODER_BAD_TYPE = 2,
    JSON_DECODER_NOT_FOUND = 3,
    JSON_DECODER_PARSE_ERROR = 4,
    JSON_DECODER_CONVERSION_FAILED = 5,
    JSON_DECODER_POP_AT_ROOT = 6,
    JSON_DECODER_INVALID_STATE = 7,
    JSON_DECODER_EXTERNAL_ERROR = 8,
    JSON_DECODER_ENCODING_ERROR = 9,
    JSON_DECODER_FILE_READ_ERROR = 10
} json_decoder_error_t;

Data:

JSON_DECODER_OK

No error condition exists.

JSON_DECODER_NO_MEMORY

The operation failed to allocate memory.

JSON_DECODER_BAD_TYPE

The requested data doesn't match the data type of the element or property.

JSON_DECODER_NOT_FOUND

The requested element or property was not found.

JSON_DECODER_PARSE_ERROR

An error occurred parsing JSON data.

JSON_DECODER_CONVERSION_FAILED

A numeric conversion failed because the result would lose precision or be out of range.

JSON_DECODER_POP_AT_ROOT

A call to json_decoder_pop() was made while at the root of the decoder tree.

JSON_DECODER_INVALID_STATE

A call to json_decoder_set_state() was made with an invalid state instance.

JSON_DECODER_EXTERNAL_ERROR

An external error has occurred. This is not used internally but may be set via json_decoder_set_status() to signal a caller-detected error.

JSON_DECODER_ENCODING_ERROR

An error occurred when using an encoder from json_decoder_get_encoder() to add or modify data in the decoder tree.

JSON_DECODER_FILE_READ_ERROR

An error occurred reading JSON data from a file. The specific error is indicated by errno.

Library:

libjson

Description:

JSON decoder error codes are returned with each json_decoder_*() function call, and are also available with json_decoder_get_status().