json_encoder_add_json()

Add a JSON-encoded string value to the JSON encoder

Synopsis:

#include <sys/json.h>
json_encoder_error_t json_encoder_add_json(json_encoder_t *encoder,
                                           const char *name,
                                           const char *value);

Arguments:

encoder
The JSON encoder instance.
name
The name of the value if it's being added to an object, or NULL if it's being added to an array or it was already named with json_encoder_add_property_name().
value
A pointer to the JSON string being added.

Library:

libjson

Description:

This function adds a JSON-encoded string value with the given name to the current object or array in the given JSON encoder.

Returns:

JSON_ENCODER_OK
Success.
JSON_ENCODER_NO_MEMORY
There is not enough memory to perform the operation.
JSON_ENCODER_UNEXPECTED_NAME
A name was provided for a value that was already named, or for an element in an array, which can't accept a name.
JSON_ENCODER_MISSING_PROPERTY_NAME
No name was provided for the value.
JSON_ENCODER_NOT_SUPPORTED
The operation is not supported with the given JSON encoder instance.