json_encoder_get_state()

QNX SDP8.0JSON Library ReferenceAPIDeveloper

Get the current state of the JSON encoder

Synopsis:

#include <sys/json.h>
json_encoder_state_t* json_encoder_get_state(json_encoder_t *encoder)

Arguments:

encoder
The JSON encoder instance.

Library:

libjson

Description:

This function returns the current state of the given JSON encoder. Getting the state allows the encoder to be restored later to that state, effectively undoing any subsequent operations that are done before json_encoder_set_state() is called. A saved state is invalidated by calls to json_encoder_reset(), json_encoder_cleanup(), or json_encoder_set_state() with an earlier state.

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.

Returns:

A pointer to the current JSON encoder state, or NULL if there was insufficient memory to get the state or the encoder instance was obtained from json_decoder_get_encoder().

Page updated: