kwid_match_id()

kwid_match_id()#

Checks if the given id exists within the JSON structure ids, which can be a string, list, or dictionary. The function returns TRUE if the id is found, otherwise FALSE.

Prototype

BOOL kwid_match_id(
    hgobj   gobj,
    json_t *ids,
    const char *id
);

Parameters

Key

Type

Description

gobj

hgobj

A handle to the GObj instance, used for logging errors.

ids

json_t *

A JSON object, array, or string containing the possible matches for id.

id

const char *

The identifier to search for within ids.


Return Value

Returns TRUE if id is found in ids, otherwise returns FALSE.

Notes

The function supports different JSON structures:

  • If ids is a string, it is directly compared to id.

  • If ids is an array, it checks for id in string elements or in objects with an id field.

  • If ids is a dictionary, it checks if id exists as a key.

Prototype

// Not applicable in JS

Prototype

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