Symisc UnQLite

An Embeddable NoSQL Database Engine

UnQLite C/C++ API Reference - JSON Array/Object handling.


unsigned int unqlite_array_count(unqlite_value *pArray);

Return the total number of entries or fields in a given JSON array/object.


This routine return the total number of entries in a given JSON array or the total number of fields in a given JSON object.

The unqlite_value must be of type array or object obtained by a prior successful call to unqlite_vm_new_array(), unqlite_context_new_array() or passed as parameter to the foreign function.

Call unqlite_value_is_json_array() or unqlite_value_is_json_object() to check if the given unqlite_value is of the expected type. 

Note: This routine is not thread-safe.



unqlite_value to query which must be of type array or object.

Return value

This function return the total number of entries on success. 0 (zero) is returned if the target array/object is empty or the given unqlite_value is not of the expected type (i.e: A scalar value such as an integer, Boolean, double, etc.).


Compile this C file for a smart introduction to the JSON array/object handling interfaces.

See also

unqlite_array_walk, unqlite_array_add_elem, unqlite_array_fetch.

Symisc Systems
Copyright © Symisc Systems