Member function documentation

int nz::udx_ver2::Json::arrayLength ( ) const

Number of elements in a JSON array.

Exceptions
SQLError this must be a JSON array, or error is triggered.
Returns
int Number of elements in a JSON array.
Json nz::udx_ver2::Json::clone ( ) const

Makes a (deep) copy of this object.

Returns
Json A copy of this object.
int nz::udx_ver2::Json::fill ( char * ptr ) const

Fills ptr with the data of this object.

Returns
int Number of bytes filled.
Json nz::udx_ver2::Json::get ( int index ) const

Gets JSON element by index.

Parameters
indEx Zero-based index of the element. Negative index is allowed.
Exceptions
SQLError Out-of-range index triggers an error.
SQLError this must be a JSON array, or error is triggered.
Returns
Json Element at index
Json nz::udx_ver2::Json::get ( const char * key ) const

Gets JSON value by key.

Parameters
key Key in a JSON key - value pair.
Exceptions
SQLError Non-existent key triggers an error.
SQLError this must be a JSON object, or error is triggered.
Returns
Json Value of the provided key.
Json nz::udx_ver2::Json::get ( const Jsonb & path ) const

Gets JSON element by path.

Parameters
path JSON array describing path to the target element.
Exceptions
SQLError Non-existent path triggers an error.
SQLError Using this method on a JSON scalar triggers an error.
Returns
Json Element identified by path.
Json& nz::udx_ver2::Json::operator= ( const Json & rhs )

Re-initializes the left operand with data from the right operand.

Note
Data is deep copied.
Parameters
rhs Right operand.
Returns
Json& Reference to the left operand.
Json nz::udx_ver2::Json::operator[] ( int index ) const

Gets JSON element by index.

Parameters
index Zero-based index of the element. Negative index is allowed.
Exceptions
SQLError Out-of-range index triggers an error.
SQLError this must be a JSON array, or error is triggered.
Returns
Json Element at index.
Json nz::udx_ver2::Json::operator[] ( const char * key ) const

Gets JSON value by key.

Parameters
key Key in a JSON key - value pair.
Exceptions
SQLError Non-existent key triggers an error.
SQLError this must be a JSON object, or error is triggered.
Returns
Jsonb Value of the respective key.
Json& nz::udx_ver2::Json::stripNulls ( )

Recursively removes all key - value pairs whose value is null from a JSON object.

Note
This method does not remove null from a JSON array.
Returns
Json& Reference to this.
char* nz::udx_ver2::Json::toString ( ) const

Converts to string.

Note
Caller is responsible for freeing return pointer.
Returns
char* JSON string.
const char* nz::udx_ver2::Json::typeName ( ) const

Type name of this JSON document.

Returns
const char* Type name of this JSON document.
Type name
"null"
"string"
"number"
"boolean"
"array"
"object"