json_decoder_get_offset()

Get the offset of the node's value within the original JSON string

Synopsis:

#include <sys/json.h>
json_decoder_error_t json_decoder_get_offset(json_decoder_t *decoder,
                                             const char *name,
                                             int *offset,
                                             int *length);

Arguments:

decoder
The JSON decoder instance.
name
The name of the node for which you want to get the offset of its value. If NULL is passed, the offset of the current node's value is retrieved.
offset
A pointer to a location for storing the offset. This is the offset of the node's value within the original JSON string.
length
A pointer to a location for storing the length of the string representing the value of this node. If the node was not part of the original JSON string, the length will be 0.

Library:

libjson

Returns:

JSON_DECODER_OK
Success.
JSON_DECODER_NOT_FOUND
The node does not exist.