kw_get_list()
#
Retrieves a JSON list from the dictionary kw
at the specified path
. If the key does not exist, it returns default_value
or creates a new list if KW_CREATE
is set in flag
.
Prototype
json_t *kw_get_list(
hgobj gobj,
json_t *kw,
const char *path,
json_t *default_value,
kw_flag_t flag
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Handle to the calling object, used for logging errors. |
|
|
JSON dictionary to search for the list. |
|
|
Path to the list within |
|
|
Default value to return if the key does not exist. Owned by the caller. |
|
|
Flags controlling behavior, such as |
Return Value
Returns a JSON list if found. If KW_CREATE
is set and the key does not exist, a new list is created and returned. If the key is not found and KW_REQUIRED
is set, an error is logged and default_value
is returned.
Notes
If KW_EXTRACT
is set in flag
, the retrieved list is removed from kw
and returned with an increased reference count. If the key exists but is not a list, an error is logged and default_value
is returned.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples