C Collections

cjson · Section 3

cjson_dictionary_remove

cjson_dictionary_remove - remove and free a key from an object node

C Collections (libccollections, -lccollections)

#include <ccollections/cjson.h>
 
ccol_retval cjson_dictionary_remove(cjson obj, const char *key);

Removes the member with the given key from the object node obj and
frees its value together with everything below it.  The remaining
members keep their order.
 
A walk with cjson_dictionary_first(3) and cjson_dictionary_next(3)
may remove the member that its cursor stands on, for example with
cjson_dictionary_remove(obj, it.key), and then go on.  Removing the
member after it, the one the cursor reads next, invalidates the
cursor, but removing any other member doesn't.

ccol_success        - the member was removed and freed.
ccol_invalid_args   - obj or key is NULL, or obj is not a CJSON_DICTIONARY.
ccol_key_not_found  - the object has no such key.

cjson_dictionary_set(3), cjson_dictionary_get(3), cjson_dictionary_first(3), cjson_list_remove(3)