kw_get_dict()#
Retrieves the dictionary value from the kw JSON object at the specified path. If the key does not exist, it returns default_value or creates a new entry if KW_CREATE is set.
Prototype
json_t *kw_get_dict(
hgobj gobj,
json_t *kw,
const char *path,
json_t *default_value,
kw_flag_t flag
);
Parameters
Key |
Type |
Description |
|---|---|---|
|
|
Handle to the calling object, used for logging errors. |
|
|
JSON object to search within. |
|
|
Path to the dictionary key, using the configured delimiter. |
|
|
Default value to return if the key is not found. |
|
|
Flags controlling behavior, such as |
Return Value
Returns the dictionary value at path if found. If KW_CREATE is set, it creates and returns a new dictionary. If the key is missing and KW_REQUIRED is set, an error is logged and default_value is returned.
Notes
If KW_EXTRACT is set, the retrieved value is removed from kw. The function logs an error if path does not exist and KW_REQUIRED is set.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples