kw_get_bool()
#
Retrieves a boolean value from a JSON dictionary at the specified path
. If the key does not exist, the default_value
is returned. Supports type conversion from integers, strings, and null values.
Prototype
BOOL kw_get_bool(
hgobj gobj,
json_t *kw,
const char *path,
BOOL default_value,
kw_flag_t flag
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the GObj instance for logging and error handling. |
|
|
JSON dictionary to search for the boolean value. |
|
|
Path to the boolean value within the JSON dictionary. |
|
|
Default boolean value to return if the key is not found. |
|
|
Flags controlling behavior, such as |
Return Value
Returns the boolean value found at path
. If the key does not exist, the default_value
is returned. If KW_EXTRACT
is set, the value is removed from kw
.
Notes
Supports type conversion: integers and real numbers are treated as TRUE
if nonzero, FALSE
otherwise. Strings are compared case-insensitively against ‘true’ and ‘false’.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples