diff options
author | Petri Lehtinen <petri@digip.org> | 2009-10-11 20:42:43 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2009-10-11 20:44:01 +0300 |
commit | 1e00cd58a514a61e829e639f1e40dac94a334561 (patch) | |
tree | 030dc7824942dd289627d77b5f5891f6a0e73ba9 /doc | |
parent | 40bb7bf4378e09570f3921cd76cdce6acc873259 (diff) | |
download | jansson-1e00cd58a514a61e829e639f1e40dac94a334561.zip jansson-1e00cd58a514a61e829e639f1e40dac94a334561.tar.gz jansson-1e00cd58a514a61e829e639f1e40dac94a334561.tar.bz2 |
Extend object API
Added functions:
json_object_size
json_object_clear
json_object_update
Diffstat (limited to 'doc')
-rw-r--r-- | doc/apiref.rst | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/apiref.rst b/doc/apiref.rst index cc6b1f1..1a6a77b 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -343,6 +343,13 @@ Unicode string and the value is any JSON value. Returns a new JSON object, or *NULL* on error. Initially, the object is empty. +.. cfunction:: unsigned int json_object_size(const json_t *object) + + Returns the number of elements in *object*, or 0 if *object* is not + a JSON object. + + .. versionadded:: 1.1 + .. cfunction:: json_t *json_object_get(const json_t *object, const char *key) .. refcounting:: borrow @@ -371,6 +378,21 @@ Unicode string and the value is any JSON value. -1 if *key* was not found. +.. cfunction:: int json_object_clear(json_t *object) + + Remove all elements from *object*. Returns 0 on success and -1 if + *object* is not a JSON object. + + .. versionadded:: 1.1 + +.. cfunction:: int json_object_update(json_t *object, json_t *other) + + Update *object* with the key-value pairs from *other*, overwriting + existing keys. Returns 0 on success or -1 on error. + + .. versionadded:: 1.1 + + The following functions implement an iteration protocol for objects: .. cfunction:: void *json_object_iter(json_t *object) |