Member function documentation

int nz::udx_ver2::Jsonb::arrayLength ( ) const
Number of elements in this JSON array (if it is a JSON array).
Exceptions
SQLError this must be a JSON array, or error is triggered.
Returns
int Number of elements in this JSON array.
Jsonb nz::udx_ver2::Jsonb::clone ( ) const
Makes a (deep) copy of this object.
Returns
Jsonb A copy of this object.
static int nz::udx_ver2::Jsonb::cmp ( const Jsonb & lhs, const Jsonb & rhs ) static
Compares two JSON documents.
Parameters
lhs Left hand side
rhs Right hand side
Returns
int Greater than 0 if lhs > rhs
int Less than 0 if lhs < rhs
int 0 if lhs = rhs
static Jsonb nz::udx_ver2::Jsonb::concat ( const Jsonb & a, const Jsonb & b ) static
Concatenates two JSON documents.
Parameters
a Input JSON document.
b Input JSON document.
Note
The followings specify how this method behaves to different combinations of JSON value type (pseudocode, not valid C++ syntax):
  1. Concatenating two JSON objects merges them into one single JSON object. Example:
    concat({"a": 1}, {"b": 2}) -> {"a": 1, "b": 2}
  2. Concatenating two JSON arrays merges them into one larger JSON array. Example:
    concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
  3. Concatenating two JSON scalars results in a JSON array enclosing both inputs. Example:
    concat(1, "string") -> [1, "string"]
  4. Concatenating any kind of JSON value and a JSON array results in the JSON value inserted into the JSON array in the order they are specified. Example:
    concat([1, 2], {"b": 3}) -> [1, 2, {"b": 3}]
    concat({"b": 3}, [1, 2]) -> [{"b": 3}, 1, 2]
Exceptions
SQLError Concatenating a JSON object and a JSON scalar triggers an error. For example, concat({"a": 1}, "string scalar") --> error (pseudocode)
Returns
Jsonb Concatenated JSON document.
static Jsonb nz::udx_ver2::Jsonb::concat ( const char * a, const Jsonb & b ) static
Concatenates two JSON documents.
Parameters
a Input JSON document.
b Input JSON document.
Note
The followings specify how this method behaves to different combinations of JSON value type (pseudocode, not valid C++ syntax):
  1. Concatenating two JSON objects merges them into one single JSON object. Example:
    concat({"a": 1}, {"b": 2}) -> {"a": 1, "b": 2}
  2. Concatenating two JSON arrays merges them into one larger JSON array. Example:
    concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
  3. Concatenating two JSON scalars results in a JSON array enclosing both inputs. Example:
    concat(1, "string") -> [1, "string"]
  4. Concatenating any kind of JSON value and a JSON array results in the JSON value inserted into the JSON array in the order they are specified. Example:
    concat([1, 2], {"b": 3}) -> [1, 2, {"b": 3}]
    concat({"b": 3}, [1, 2]) -> [{"b": 3}, 1, 2]
Exceptions
SQLError Concatenating a JSON object and a JSON scalar triggers an error. For example, concat({"a": 1}, "string scalar") --> error (pseudocode)
Returns
Jsonb Concatenated JSON document.
static Jsonb nz::udx_ver2::Jsonb::concat ( const Jsonb & a, const char * b ) static
Concatenates two JSON documents.
Parameters
a Input JSON document.
b Input JSON document.
Note
The followings specify how this method behaves to different combinations of JSON value type (pseudocode, not valid C++ syntax):
  1. Concatenating two JSON objects merges them into one single JSON object. Example:
    concat({"a": 1}, {"b": 2}) -> {"a": 1, "b": 2}
  2. Concatenating two JSON arrays merges them into one larger JSON array. Example:
    concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
  3. Concatenating two JSON scalars results in a JSON array enclosing both inputs. Example:
    concat(1, "string") -> [1, "string"]
  4. Concatenating any kind of JSON value and a JSON array results in the JSON value inserted into the JSON array in the order they are specified. Example:
    concat([1, 2], {"b": 3}) -> [1, 2, {"b": 3}]
    concat({"b": 3}, [1, 2]) -> [{"b": 3}, 1, 2]
Exceptions
SQLError Concatenating a JSON object and a JSON scalar triggers an error. For example, concat({"a": 1}, "string scalar") --> error (pseudocode)
Returns
Jsonb Concatenated JSON document.
static Jsonb nz::udx_ver2::Jsonb::concat ( const char * a, const char * b ) static
Concatenates two JSON documents.
Parameters
a Input JSON document.
b Input JSON document.
Note
The followings specify how this method behaves to different combinations of JSON value type (pseudocode, not valid C++ syntax):
  1. Concatenating two JSON objects merges them into one single JSON object. Example:
    concat({"a": 1}, {"b": 2}) -> {"a": 1, "b": 2}
  2. Concatenating two JSON arrays merges them into one larger JSON array. Example:
    concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
  3. Concatenating two JSON scalars results in a JSON array enclosing both inputs. Example:
    concat(1, "string") -> [1, "string"]
  4. Concatenating any kind of JSON value and a JSON array results in the JSON value inserted into the JSON array in the order they are specified. Example:
    concat([1, 2], {"b": 3}) -> [1, 2, {"b": 3}]
    concat({"b": 3}, [1, 2]) -> [{"b": 3}, 1, 2]
Exceptions
SQLError Concatenating a JSON object and a JSON scalar triggers an error. For example, concat({"a": 1}, "string scalar") --> error (pseudocode)
Returns
Jsonb Concatenated JSON document.
bool nz::udx_ver2::Jsonb::contained ( const Jsonb & other ) const
Checks if this JSON document is a subset of another JSON document.
Parameters
other The other JSON document to check against.
Returns
true If this is a subset of other.
false Otherwise.
bool nz::udx_ver2::Jsonb::contained ( const char * other ) const
Checks if this JSON document is a subset of another JSON document.
Parameters
other The other JSON document (as string) to check against.
Returns
true If this is a subset of other.
false Otherwise.
bool nz::udx_ver2::Jsonb::contains ( const Jsonb & other ) const
Checks if this JSON document is a superset of another JSON document.
Parameters
other The other JSON document to check against.
Returns
true If this is a superset of other.
false Otherwise.
bool nz::udx_ver2::Jsonb::contains ( const char * other ) const
Checks if this JSON document is a superset of another JSON document.
Parameters
other The other JSON document (as string) to check against.
Returns
true If this is a superset of other.
false Otherwise.
bool nz::udx_ver2::Jsonb::exists ( const char * key ) const
Checks if a key exists in this JSON document.
Parameters
key Key in a key - value pair.
Returns
true If key exists in this JSON document.
false Otherwise.
NullableBool nz::udx_ver2::Jsonb::exists ( const JsonPath & path ) const
Checks if JsonPath query returns any item.
Parameters
path JsonPath query.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
NB_TRUE If JsonPath query returns an item.
NB_FALSE If JsonPath query does not return any item.
NullableBool nz::udx_ver2::Jsonb::exists ( const JsonPath & path, bool silent ) const
Checks if JsonPath query returns any item.
Parameters
path JsonPath query.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
NB_TRUE If JsonPath query returns an item.
NB_FALSE If JsonPath query does not return any item.
NB_NULL If there has been an error.
NullableBool nz::udx_ver2::Jsonb::exists ( const JsonPath & path, const Jsonb & vars ) const
Checks if JsonPath query returns any item.
Parameters
path JsonPath query.
vars Variables used in path.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
NB_TRUE If JsonPath query returns an item.
NB_FALSE If JsonPath query does not return any item.
NullableBool nz::udx_ver2::Jsonb::exists ( const JsonPath & path, const Jsonb & vars, bool silent ) const
Checks if JsonPath query returns any item.
Parameters
path JsonPath query.
vars Variables used in path.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
NB_TRUE If JsonPath query returns an item.
NB_FALSE If JsonPath query does not return any item.
NB_NULL If there has been an error.
bool nz::udx_ver2::Jsonb::existsAll ( const Jsonb & keys ) const
Checks if all provided keys exist in this JSON document.
Parameters
keys JSON array of keys.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If all keys exist.
false If at least one key does not exist.
bool nz::udx_ver2::Jsonb::existsAll ( const Jsonb & keys, bool silent ) const
Checks if all provided keys exist in this JSON document.
Parameters
keys JSON array of keys.
silent true to suppress errors due to invalid element type in keys; false otherwise.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If all keys exist.
false If at least one key does not exist.
bool nz::udx_ver2::Jsonb::existsAll ( const char * keys ) const
Checks if all provided keys exist in this JSON document.
Parameters
keys JSON array of keys.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If all keys exist.
false If at least one key does not exist.
bool nz::udx_ver2::Jsonb::existsAll ( const char * keys, bool silent ) const
Checks if all provided keys exist in this JSON document.
Parameters
keys JSON array of keys.
silent true to suppress errors due to invalid element type in keys; false otherwise.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If all keys exist.
false If at least one key does not exist.
bool nz::udx_ver2::Jsonb::existsAny ( const Jsonb & keys ) const
Checks if any of the provided keys exists in this JSON document.
Parameters
keys JSON array of keys.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If at least one key exists.
false If none of the keys exists.
bool nz::udx_ver2::Jsonb::existsAny ( const Jsonb & keys, bool silent ) const
Checks if any of the provided keys exists in this JSON document.
Parameters
keys JSON array of keys.
silent true to suppress errors due to invalid element type in keys; false otherwise.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If at least one key exists.
false If none of the keys exists.
bool nz::udx_ver2::Jsonb::existsAny ( const char * keys ) const
Checks if any of the provided keys exists in this JSON document.
Parameters
keys JSON array of keys.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If at least one key exists.
false If none of the keys exists.
bool nz::udx_ver2::Jsonb::existsAny ( const char * keys, bool silent ) const
Checks if any of the provided keys exists in this JSON document.
Parameters
keys JSON array of keys.
silent true to suppress errors due to invalid element type in keys; false otherwise.
Exceptions
SQLError If keys is not a JSON array or contains invalid element type (only strings are accepted as keys).
Returns
true If at least one key exists.
false If none of the keys exists.
int nz::udx_ver2::Jsonb::fill ( char * ptr ) const
Fills ptr with the data of this object.
Returns
int Number of bytes filled.
Jsonb nz::udx_ver2::Jsonb::get ( const char * key ) const
Gets JSON value by key.
Parameters
key Key in a 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 provided key.
Jsonb nz::udx_ver2::Jsonb::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
Jsonb Element at index.
Jsonb nz::udx_ver2::Jsonb::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
Jsonb Element identified by path.
Jsonb& nz::udx_ver2::Jsonb::insert ( const Jsonb & path, const Jsonb & value )
Inserts a new value into this JSON document.
Note
By default, if this JSON document is an JSON array, value will be inserted before the element identified by path.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const char * path, const Jsonb & value )
Inserts a new value into this JSON document.
Note
By default, if this JSON document is an JSON array, value will be inserted before the element identified by path.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const Jsonb & path, const char * value )
Inserts a new value into this JSON document.
Note
By default, if this JSON document is an JSON array, value will be inserted before the element identified by path.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const char * path, const char * value )
Inserts a new value into this JSON document.
Note
By default, if this JSON document is an JSON array, value will be inserted before the element identified by path.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const Jsonb & path, const Jsonb & value, bool after )
Inserts a new value into this JSON document.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
after Only used when this JSON document is a JSON array: true to insert value after the element identified by path; false to insert value before the element identified by path.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const char * path, const Jsonb & value, bool after )
Inserts a new value into this JSON document.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
after Only used when this JSON document is a JSON array: true to insert value after the element identified by path; false to insert value before the element identified by path.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const Jsonb & path, const char * value, bool after )
Inserts a new value into this JSON document.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
after Only used when this JSON document is a JSON array: true to insert value after the element identified by path; false to insert value before the element identified by path.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::insert ( const char * path, const char * value, bool after )
Inserts a new value into this JSON document.
Parameters
path Path to the point of insertion. Must be a JSON array.
value New value.
after Only used when this JSON document is a JSON array: true to insert value after the element identified by path; false to insert value before the element identified by path.
Returns
Jsonb& Reference to this, which can be used for method chaining.
NullableBool nz::udx_ver2::Jsonb::match ( const JsonPath & path ) const
Returns the result of JsonPath predicate check.
Note
Only the first item of the result is taken into account.
Parameters
path JsonPath query.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error (can be supressed by a silent argument).
SQLError Not having single result also triggers an error (can be supressed by a silent argument).
Returns
NB_TRUE If JsonPath predicate check returns true.
NB_FALSE If JsonPath predicate check returns false.
NB_NULL If JsonPath predicate check returns null.
NullableBool nz::udx_ver2::Jsonb::match ( const JsonPath & path, bool silent ) const
Returns the result of JsonPath predicate check.
Note
Only the first item of the result is taken into account.
Parameters
path JsonPath query.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode or due to not having single result. false otherwise.
Returns
NB_TRUE If JsonPath predicate check returns true.
NB_FALSE If JsonPath predicate check returns false.
NB_NULL If silent is false and JsonPath predicate check returns null. Or, if silent is true and there has been an error due to structural inconsistency or due to not having single result.
NullableBool nz::udx_ver2::Jsonb::match ( const JsonPath & path, const Jsonb & vars ) const
Returns the result of JsonPath predicate check.
Note
Only the first item of the result is taken into account.
Parameters
path JsonPath query.
vars Variables used in path.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error (can be supressed by a silent argument).
SQLError Not having single result also triggers an error (can be supressed by a silent argument).
Returns
NB_TRUE If JsonPath predicate check returns true.
NB_FALSE If JsonPath predicate check returns false.
NB_NULL If JsonPath predicate check returns null.
NullableBool nz::udx_ver2::Jsonb::match ( const JsonPath & path, const Jsonb & vars, bool silent ) const
Returns the result of JsonPath predicate check.
Note
Only the first item of the result is taken into account.
Parameters
path JsonPath query.
vars Variables used in path.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode or due to not having single result. false otherwise.
Returns
NB_TRUE If JsonPath predicate check returns true.
NB_FALSE If JsonPath predicate check returns false.
NB_NULL If silent is false and JsonPath predicate check returns null. Or, if silent is true and there has been an error due to structural inconsistency or due to not having single result.
bool nz::udx_ver2::Jsonb::operator!= ( const Jsonb & rhs ) const
Inequality operator.
Parameters
rhs Right operand.
Returns
true If this is not equal to rhs.
false If this is equal to rhs.
bool nz::udx_ver2::Jsonb::operator!= ( const char * rhs ) const
Inequality operator.
Parameters
rhs Right operand as a JSON string.
Exceptions
SQLError invalid JSON string for rhs triggers an error.
Returns
true If this is not equal to rhs.
false If this is equal to rhs.
Jsonb nz::udx_ver2::Jsonb::operator+ ( const Jsonb & rhs ) const
Concatemates this JSON document with another JSON document.
Parameters
rhs Right operand.
Returns
Jsonb Combined JSON document.
Jsonb nz::udx_ver2::Jsonb::operator+ ( const char * rhs ) const
Concatemates this JSON document with another JSON document.
Parameters
rhs Right operand as a JSON string.
Returns
Jsonb Combined JSON document.
Jsonb& nz::udx_ver2::Jsonb::operator+= ( const Jsonb & rhs )
Concatemates this JSON document with another JSON document and assigns the result back to this.
Parameters
rhs Right operand.
Returns
Jsonb& Reference to this.
Jsonb& nz::udx_ver2::Jsonb::operator+= ( const char * rhs )
Concatemates this JSON document with another JSON document and assigns the result back to this.
Parameters
rhs Right operand as a JSON string.
Returns
Jsonb& Reference to this.
Jsonb nz::udx_ver2::Jsonb::operator- ( int rhs ) const
Removes an element from a JSON array using index.
Parameters
rhs Index of to-be-removed element. Negative index is allowed. Out-of-range index is ignored.
Exceptions
SQLError this must be a JSON array, or error is triggered.
Returns
Jsonb New Jsonb object with the element at index rhs removed.
Jsonb nz::udx_ver2::Jsonb::operator- ( const char * rhs ) const
Removes a key - value pair from a JSON object using key.
Parameters
rhs Key of to-be-removed pair.
Exceptions
SQLError Using this operator on a JSON scalar triggers an error.
Returns
Jsonb New Jsonb object with the key -value pair removed.
Jsonb& nz::udx_ver2::Jsonb::operator-= ( int rhs )
Removes an element from a JSON array using index and assigns the result back to this.
Parameters
rhs Index of to-be-removed element. Negative index is allowed. Out-of-range index is ignored.
Exceptions
SQLError this must be a JSON array, or error is triggered.
Returns
Jsonb& Reference to this.
Jsonb& nz::udx_ver2::Jsonb::operator-= ( const char * rhs )
Removes a key - value pair from a JSON object using key and assigns the result back to this.
Parameters
rhs Key of to-be-removed pair.
Exceptions
SQLError Using this method on a JSON scalar triggers an error.
Returns
Jsonb& Reference to this.
bool nz::udx_ver2::Jsonb::operator< ( const Jsonb & rhs ) const
Less than operator.
Parameters
rhs Right operand.
Returns
true If this is less than rhs.
false If this is greater than or equal to rhs.
bool nz::udx_ver2::Jsonb::operator< ( const char * rhs ) const
Less than operator.
Parameters
rhs Right operand as a JSON string.
Exceptions
SQLError invalid JSON string for rhs triggers an error.
Returns
true If this is less than rhs.
false If this is greater than or equal to rhs.
bool nz::udx_ver2::Jsonb::operator<= ( const Jsonb & rhs ) const

Less than or equal operator.

Parameters
rhs Right operand.
Returns
true If this is less than or equal to rhs.
false If this is greater than rhs.
bool nz::udx_ver2::Jsonb::operator<= ( const char * rhs ) const
Less than or equal operator.
Parameters
rhs Right operand as a JSON string.
Exceptions
SQLError invalid JSON string for rhs triggers an error.
Returns
true If this is less than or equal to rhs.
false If this is greater than rhs.
Jsonb& nz::udx_ver2::Jsonb::operator= ( const Jsonb & rhs )

Assignment operator.

Re-initializes the left operand with a copy of data from the right operand (deep copy).

Parameters
rhs Right operand.
Returns
Jsonb& Reference to this.
bool nz::udx_ver2::Jsonb::operator== ( const Jsonb & rhs ) const

Equality operator.

Parameters
rhs Right operand.
Returns
true If this is equal to rhs.
false If this is not equal to rhs.
bool nz::udx_ver2::Jsonb::operator== ( const char * rhs ) const

Equality operator.

Parameters
rhs Right operand as a JSON string.
Exceptions
SQLError invalid JSON string for rhs triggers an error.
Returns
true If this is equal to rhs.
false If this is not equal to rhs.
bool nz::udx_ver2::Jsonb::operator> ( const Jsonb & rhs ) const

Greater than operator.

Parameters
rhs Right operand.
Returns
true If this is greater than rhs.
false If this is less than or equal to rhs.
bool nz::udx_ver2::Jsonb::operator> ( const char * rhs ) const

Greater than operator.

Parameters
rhs Right operand as a JSON string.
Exceptions
SQLError invalid JSON string for rhs triggers an error.
Returns
true If this is greater than rhs.
false If this is less than or equal to rhs.
bool nz::udx_ver2::Jsonb::operator>= ( const Jsonb & rhs ) const
Greater than or equal operator.
Parameters
rhs Right operand.
Returns
true If this is greater than or equal to rhs.
false If this is less than rhs.
bool nz::udx_ver2::Jsonb::operator>= ( const char * rhs ) const

Greater than or equal operator.

Parameters
rhs Right operand as a JSON string.
Exceptions
SQLError invalid JSON string for rhs triggers an error.
Returns
true If this is greater than or equal to rhs.
false If this is less than rhs.
Jsonb nz::udx_ver2::Jsonb::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
Jsonb Element at index.
Jsonb nz::udx_ver2::Jsonb::operator[] ( const char * key ) const
Gets JSON value by key.
Parameters
key Key in a 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 provided key.
char* nz::udx_ver2::Jsonb::pretty ( ) const

Converts to indented string.

Returns
Char* indented string.
int nz::udx_ver2::Jsonb::query ( const JsonPath & path, Jsonb & out ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array (alias to queryArray()).

Parameters
path JsonPath query.
out Out reference which holds the result.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::query ( const JsonPath & path, Jsonb & out, bool silent ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array (alias to queryArray()).

Parameters
path JsonPath query.
out Out reference which holds the result.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::query ( const JsonPath & path, Jsonb & out, const Jsonb & vars ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array (alias to queryArray()).

Parameters
path JsonPath query.
out Out reference which holds the result.
vars Variables used in path.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::query ( const JsonPath & path, Jsonb & out, const Jsonb & vars, bool silent ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array (alias to queryArray()).

Parameters
path JsonPath query.
out Out reference which holds the result.
vars Variables used in path.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::queryArray ( const JsonPath & path, Jsonb & out ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array.

Parameters
path JsonPath query.
out Out reference which holds the result.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::queryArray ( const JsonPath & path, Jsonb & out, bool silent ) const
Gets all JSON elements returned by JsonPath query and wraps result into an array.
Parameters
path JsonPath query.
out Out reference which holds the result.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::queryArray ( const JsonPath & path, Jsonb & out, const Jsonb & vars ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array.

Parameters
path JsonPath query.
out Out reference which holds the result.
vars Variables used in path.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
int Number of items returned.
int nz::udx_ver2::Jsonb::queryArray ( const JsonPath & path, Jsonb & out, const Jsonb & vars, bool silent ) const

Gets all JSON elements returned by JsonPath query and wraps result into an array.

Parameters
path JsonPath query.
out Out reference which holds the result.
vars Variables used in path.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
int Number of items returned.
bool nz::udx_ver2::Jsonb::queryFirst ( const JsonPath & path, Jsonb & out ) const

Gets the first JSON element returned by JsonPath query.

Parameters
path JsonPath query.
out Out reference which holds the result. Only set when this method returns true.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
true If there is a result (stored in out).
false If there is no result.
bool nz::udx_ver2::Jsonb::queryFirst ( const JsonPath & path, Jsonb & out, bool silent ) const

Gets the first JSON element returned by JsonPath query.

Parameters
path JsonPath query.
out Out reference which holds the result. Only set when this method returns true.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
true If there is a result (stored in out).
false If there is no result.
bool nz::udx_ver2::Jsonb::queryFirst ( const JsonPath & path, Jsonb & out, const Jsonb & vars ) const

Gets the first JSON element returned by JsonPath query.

Parameters
path JsonPath query.
out Out reference which holds the result. Only set when this method returns true.
vars Variables used in path.
Exceptions
SQLError In JsonPath's strict mode, any strutural inconsistency between path and this JSON document will trigger an error.
Returns
true If there is a result (stored in out).
false If there is no result.
bool nz::udx_ver2::Jsonb::queryFirst ( const JsonPath & path, Jsonb & out, const Jsonb & vars, bool silent ) const

Gets the first JSON element returned by JsonPath query.

Parameters
path JsonPath query.
out Out reference which holds the result. Only set when this method returns true.
vars Variables used in path.
silent true to suppress errors due to structural inconsistency in JsonPath's strict mode; false otherwise.
Returns
true If there is a result (stored in out).
false If there is no result.
Jsonb& nz::udx_ver2::Jsonb::remove ( const char * key )

Removes a key - value pair from a JSON object using key.

Parameters
key Key of to-be-removed pair.
Exceptions
SQLError Using this method on a JSON scalar triggers an error.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::remove ( int index )

Removes an element from a JSON array using index.

Parameters
index Index of to-be-removed element. Negative index is allowed. Out-of-range index is ignored.
Exceptions
SQLError this must be a JSON array, or error is triggered.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::removeArray ( const Jsonb & keys )

Removes multiple key - value pairs from a JSON object using an array of keys.

Parameters
keys Keys of to-be-removed pairs. Must be a JSON array.
Exceptions
SQLError Using this method on a JSON scalar triggers an error.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::removeArray ( const char * keys )

Removes multiple key - value pairs from a JSON object using an array of keys.

Parameters
keys Keys of to-be-removed pairs. Must be a JSON array.
Exceptions
SQLError Using this method on a JSON scalar triggers an error.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::removePath ( const Jsonb & path )

Removes an JSON element identified by path.

Parameters
path Path to to-be-removed element. Must be a JSON array. Non-existent path is ignored.
Exceptions
SQLError Using this method on a JSON scalar triggers an error.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::removePath ( const char * path )

Removes an JSON element identified by path.

Parameters
path Path to to-be-removed element. Must be a JSON array. Non-existent path is ignored.
Exceptions
SQLError Using this method on a JSON scalar triggers an error.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const Jsonb & path, const Jsonb & value )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value
Note
By default, if the element does not exist, a new element is created.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const char * path, const Jsonb & value )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value
Note
By default, if the element does not exist, a new element is created.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const Jsonb & path, const char * value )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value
Note
By default, if the element does not exist, a new element is created.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const char * path, const char * value )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value
Note
By default, if the element does not exist, a new element is created.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const Jsonb & path, const Jsonb & value, bool create )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value.
create Whether to create a new element if it does not exist.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const char * path, const Jsonb & value, bool create )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value.
create Whether to create a new element if it does not exist.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const Jsonb & path, const char * value, bool create )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value.
create Whether to create a new element if it does not exist.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::set ( const char * path, const char * value, bool create )

Sets value for an element identified by path.

Parameters
path Path to an existing element. Must be a JSON array.
value New value.
create Whether to create a new element if it does not exist.
Returns
Jsonb& Reference to this, which can be used for method chaining.
Jsonb& nz::udx_ver2::Jsonb::stripNulls ( )

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

Note
This method does not remove nulls from a JSON array.
Returns
Jsonb& Reference to this.
bool nz::udx_ver2::Jsonb::toBool ( ) const

Converts to bool.

Exceptions
SQLError this must be a JSON boolean, or error is triggered.
Returns
bool Value of the JSON boolean.
double nz::udx_ver2::Jsonb::toDouble ( ) const

Converts to double.

Exceptions
SQLError this must be a JSON numeric, or error is triggered.
Returns
double Value of the JSON numeric.
float nz::udx_ver2::Jsonb::toFloat ( ) const

Converts to float.

Exceptions
SQLError this must be a JSON numeric, or error is triggered.
Returns
float Value of the JSON numeric.
int16 nz::udx_ver2::Jsonb::toInt16 ( ) const

Converts to int16.

Exceptions
SQLError this must be a JSON numeric, or error is triggered.
Returns
int16 Value of the JSON numeric.
int32 nz::udx_ver2::Jsonb::toInt32 ( ) const

Converts to int32.

Exceptions
SQLError this must be a JSON numeric, or error is triggered.
Returns
int32 Value of the JSON numeric.
int64 nz::udx_ver2::Jsonb::toInt64 ( ) const

Converts to int64.

Exceptions
SQLError this must be a JSON numeric, or error is triggered.
Returns
int64 Value of the JSON numeric.
int8 nz::udx_ver2::Jsonb::toInt8 ( ) const

Converts to int8.

Exceptions
SQLError this must be a JSON numeric, or error is triggered.
Returns
int8 Value of the JSON numeric.
char* nz::udx_ver2::Jsonb::toString ( ) const

Converts to string.

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

Type of this JSON document.

Returns
JbvType Type of JSON document.
JbvType
JBV_NULL
JBV_STRING
JBV_NUMERIC
JBV_BOOL
JBV_ARRAY
JBV_OBJECT
const char* nz::udx_ver2::Jsonb::typeName ( ) const

Type name of this JSON document.

Returns
const char* Type name of this JSON document.
JbvType Type name
JBV_NULL "null"
JBV_STRING "string"
JBV_NUMERIC "number"
JBV_BOOL "boolean"
JBV_ARRAY "array"
JBV_OBJECT "object"