kw_find_json_in_list()#
Search for a JSON item in a JSON list and return its index. If the item is not found, return -1. The comparison is performed using json_is_identical().
Prototype
int kw_find_json_in_list(
hgobj gobj,
json_t *kw_list, // not owned
json_t *item, // not owned
kw_flag_t flag
);
Parameters
Key |
Type |
Description |
|---|---|---|
|
|
Pointer to the gobj context. |
|
|
JSON array to search within. Must not be NULL. |
|
|
JSON item to search for in |
|
|
Flags to modify behavior. If |
Return Value
Returns the index of item in kw_list if found, otherwise returns -1.
Notes
If kw_list is not a JSON array or item is NULL, the function returns -1. If KW_VERBOSE is set in flag, an error message is logged when item is not found.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples