json_list_str_index()

json_list_str_index()#

The function json_list_str_index() searches for a string in a JSON array and returns its index if found, or -1 if not found.

Prototype

int json_list_str_index(
    json_t *jn_list,
    const char *str,
    BOOL ignore_case
);

Parameters

Key

Type

Description

jn_list

json_t *

A JSON array to search within.

str

const char *

The string to search for in the JSON array.

ignore_case

BOOL

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


Return Value

Returns the index of the string in the JSON array if found, or -1 if not found.

Notes

The function expects jn_list to be a JSON array. If jn_list is not an array, an error is logged.

Prototype

// Not applicable in JS

Prototype

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