json_decoder_get_encoder()

Return an encoder instance for adding or updating nodes in the decoder tree

Synopsis:

#include <sys/json.h>
json_encoder_t* json_decoder_get_encoder(json_decoder_t *decoder);

Arguments:

decoder
The JSON decoder instance.

Library:

libjson

Description:

This function returns a JSON encoder instance that enables adding new nodes to the decoder tree or updating existing ones. New nodes are inserted within the object or array before the node at which the decoder is currently positioned. Adding a new node that has the same name as an existing node will update the value of the existing node. The encoder remains valid until json_decoder_cleanup(), json_decoder_destroy(), or json_encoder_destroy() is called.

The encoder returned by this function can modify the decoder tree but can't generate a JSON string. If you want an encoder for doing so, you must create one with json_encoder_create().

Returns:

The JSON encoder instance.