json_encoder_set_format()

Set the JSON encoder format

Synopsis:

#include <sys/json.h>
void json_encoder_set_format(json_encoder_t *encoder,
                             json_encoder_format_t format);

Arguments:

encoder
The JSON encoder instance.
format
The new format for the encoder (see json_encoder_format_t).

Library:

libjson

Description:

This function sets the format for data subsequently encoded with the encoder instance. The format should be set only immediately after calling json_encoder_create(), json_encoder_cleanup(), or json_encoder_reset(). The default JSON encoder format is JSON_ENCODER_FORMAT_JSON.

Note:

This call has no effect on an encoder instance obtained from json_decoder_get_encoder(), since JSON items encoded with these encoders are added directly to the decoder tree rather than into a JSON-formatted buffer.