json_encoder_error_t

JSON encoder error codes

Synopsis:

#include <sys/json.h>
typedef enum {
    JSON_ENCODER_OK = 0,
    JSON_ENCODER_NO_MEMORY = 1,
    JSON_ENCODER_BAD_NESTING = 2,
    JSON_ENCODER_INVALID_VALUE = 3,
    JSON_ENCODER_MISSING_PROPERTY_NAME = 4,
    JSON_ENCODER_NOT_FOUND = 5,
    JSON_ENCODER_NOT_SUPPORTED = 6,
    JSON_ENCODER_TOO_MANY_VALUES = 7,
    JSON_ENCODER_UNEXPECTED_NAME = 8,
    JSON_ENCODER_MAX_LEVEL_REACHED = 9,
    JSON_ENCODER_INVALID_STATE = 10,
    JSON_ENCODER_EXTERNAL_ERROR = 11
} json_encoder_error_t;

Data:

JSON_ENCODER_OK

No error condition exists.

JSON_ENCODER_NO_MEMORY

The operation failed to allocate memory.

JSON_ENCODER_BAD_NESTING

Encoding failed because of improper object or array nesting.

JSON_ENCODER_INVALID_VALUE

Encoding failed because of an invalid value.

JSON_ENCODER_MISSING_PROPERTY_NAME

Encoding failed attempting to add a value with no property name.

JSON_ENCODER_NOT_FOUND

Encoding failed attempting to encode from a non-existent node of a decoder.

JSON_ENCODER_NOT_SUPPORTED

The operation is not supported.

JSON_ENCODER_TOO_MANY_VALUES

Encoding failed attempting to add a second value when only a single value is allowed.

JSON_ENCODER_UNEXPECTED_NAME

Encoding failed attempting to add a named property when only nameless elements are allowed (e.g., within an array).

JSON_ENCODER_MAX_LEVEL_REACHED

Encoding failed attempting to exceed the maximum nesting level.

JSON_ENCODER_INVALID_STATE

The state provided to json_encoder_set_state() was invalid.

JSON_ENCODER_EXTERNAL_ERROR

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

Library:

libjson

Description:

These error codes are returned with most json_encoder_*() function calls during encoding operations, and are also available through json_encoder_get_status().