kw_get_real()
#
Retrieves the real (floating-point) value associated with the given path
in the JSON dictionary kw
. If the key does not exist, the default_value
is returned. Supports automatic type conversion for integers, booleans, and strings when KW_WILD_NUMBER
is set.
Prototype
double kw_get_real(
hgobj gobj,
json_t *kw,
const char *path,
double default_value,
kw_flag_t flag
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Handle to the GObj instance, used for logging errors. |
|
|
JSON dictionary to search for the specified |
|
|
Path to the desired real value within the JSON dictionary. |
|
|
Value to return if the key does not exist or is of an incompatible type. |
|
|
Flags controlling behavior, such as |
Return Value
Returns the real (floating-point) value found at path
. If the key does not exist or is incompatible, default_value
is returned.
Notes
If KW_WILD_NUMBER
is set, the function attempts to convert integers, booleans, and numeric strings to a real value. If KW_REQUIRED
is set and the key is missing, an error is logged.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples