kw_get_str()
#
Retrieve a string value from a JSON dictionary at the specified path
. If the key does not exist, return default_value
.
Prototype
const char *kw_get_str(
hgobj gobj,
json_t *kw,
const char *path,
const char *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 string value. |
|
|
Path to the key in the JSON dictionary. |
|
|
Default string value to return if the key is not found. |
|
|
Flags to control behavior, such as |
Return Value
Returns the string value associated with path
in kw
. If the key does not exist, returns default_value
. If KW_EXTRACT
is set, the key is removed from kw
.
Notes
If the value at path
is not a string, an error is logged, and default_value
is returned. The function does not duplicate the returned string, so it should not be modified.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples