gobj_write_json_attr()
#
Writes a JSON value to the specified attribute of a hgobj
. The function ensures that the attribute exists and is of the correct type before updating its value.
Prototype
int gobj_write_json_attr(
hgobj gobj,
const char *name,
json_t *jn_value
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The |
|
|
The name of the attribute to update. |
|
|
The new JSON value to assign to the attribute. The function increases the reference count of this value. |
Return Value
Returns 0 on success, or -1 if the attribute does not exist or an error occurs.
Notes
If the attribute does not exist, a warning is logged. The function does not check if the provided value matches the expected type of the attribute.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples