json_encoder_nesting_level()

Get the current nesting level in the JSON encoder

Synopsis:

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

Arguments:

encoder
The JSON encoder instance.

Library:

libjson

Description:

This function gets the current nesting level in the given JSON encoder. The JSON encoder maintains this nesting level for the data being encoded. Each time json_encoder_start_array() or json_encoder_start_object() is called, or json_encoder_end_array() or json_encoder_end_object() is called, the nesting level increases or decreases by one.

The nesting level is initialized to zero after a call to json_encoder_create(), json_encoder_cleanup(), or json_encoder_reset().

Returns:

The current nesting level.