json_encoder_length()

Get the current data length in the JSON encoder

Synopsis:

#include <sys/json.h>
int json_encoder_length(const json_encoder_t *encoder);

Arguments:

encoder
The JSON encoder instance.

Library:

libjson

Description:

This function returns the current length of the data encoded by the given JSON encoder.

Note:

This call is not applicable to encoder instances 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.

Returns:

The current length of the encoded data, or -1 if the encoder instance was obtained from json_decoder_get_encoder().