kw_get_dict_value()
#
Retrieves a JSON value from the dictionary kw
using the specified path
. If the key does not exist, it returns default_value
based on the provided flag
options.
Prototype
json_t *kw_get_dict_value(
hgobj gobj,
json_t *kw,
const char *path,
json_t *default_value, // owned
kw_flag_t flag
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A handle to the calling object, used for logging and error reporting. |
|
|
A JSON dictionary from which the value is retrieved. |
|
|
The key path used to locate the value within |
|
|
The default value to return if the key is not found. This value is owned by the caller. |
|
|
Flags that modify the behavior of the function, such as |
Return Value
Returns the JSON value found at path
. If the key does not exist, it returns default_value
based on the flag
settings. If KW_EXTRACT
is set, the value is removed from kw
.
Notes
If KW_REQUIRED
is set and the key is not found, an error is logged. If KW_CREATE
is set, default_value
is inserted into kw
if the key does not exist.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples