kw_get_list_value()

kw_get_list_value()#

Retrieves the JSON value at the specified index from the JSON list kw. If the index is out of bounds and KW_REQUIRED is set, an error is logged. If KW_EXTRACT is set, the value is removed from the list.

Prototype

json_t *kw_get_list_value(
    hgobj     gobj,
    json_t    *kw,
    int        idx,
    kw_flag_t  flag
);

Parameters

Key

Type

Description

gobj

hgobj

Pointer to the gobj context, used for logging errors.

kw

json_t *

A JSON list from which the value is retrieved.

idx

int

The index of the value to retrieve.

flag

kw_flag_t

Flags controlling behavior, such as KW_REQUIRED for error logging and KW_EXTRACT for removing the value.


Return Value

Returns the JSON value at the specified index. If KW_EXTRACT is set, the value is removed from the list. Returns NULL if the index is out of bounds or kw is not a list.

Notes

If kw is not a JSON array, an error is logged. If KW_REQUIRED is set and the index is out of bounds, an error is also logged.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples