json_str_in_list()

json_str_in_list()#

Checks if a given string exists within a JSON array of strings.

Prototype

PUBLIC BOOL json_str_in_list(
    hgobj gobj,
    json_t *jn_list,
    const char *str,
    BOOL ignore_case
);

Parameters

Key

Type

Description

gobj

hgobj

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

jn_list

json_t *

A JSON array containing string elements to be searched.

str

const char *

The string to search for within the JSON array.

ignore_case

BOOL

If TRUE, the comparison is case-insensitive; otherwise, it is case-sensitive.


Return Value

Returns TRUE if the string is found in the JSON array, otherwise returns FALSE.

Notes

If jn_list is not a JSON array, an error is logged using gobj_log_error().

Prototype

// Not applicable in JS

Prototype

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