diff options
author | Henrique Cabral <hcabral@veniam.com> | 2019-01-11 12:50:37 +0000 |
---|---|---|
committer | allen <leloucharcher@163.com> | 2019-10-11 11:20:25 +0800 |
commit | cb4727c4a931a471f7d2f1594b162a71349b4dfe (patch) | |
tree | 8c0edea0c052a6d06bf5c3fb8db07d1e53512351 /doc | |
parent | 672b6df4743dbf76e059c640ad3fe45f7c795594 (diff) | |
download | jansson-cb4727c4a931a471f7d2f1594b162a71349b4dfe.zip jansson-cb4727c4a931a471f7d2f1594b162a71349b4dfe.tar.gz jansson-cb4727c4a931a471f7d2f1594b162a71349b4dfe.tar.bz2 |
Add json_object_update_recursive()
Support merging values nested within objects. For instance, merging:
{
"foo": 1,
"bar": {
"baz": 2
}
}
with
{
"bar": {
"baz": 3
}
}
results in
{
"foo": 1,
"bar": {
"baz": 3
}
}
instead of overwriting the value for the bar key.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/apiref.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/apiref.rst b/doc/apiref.rst index 3c4fa47..07962d1 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -708,6 +708,12 @@ allowed in object keys. .. versionadded:: 2.3 +.. function:: int json_object_update_recursive(json_t *object, json_t *other) + + Like :func:`json_object_update()`, but object values in *other* are + recursively merged with the corresponding values in *object* if they are also + objects, instead of overwriting them. Returns 0 on success or -1 on error. + .. function:: json_object_foreach(object, key, value) Iterate over every key-value pair of ``object``, running the block |