Jsonb class reference

Public member functions

~Jsonb ()
Destructor.
Jsonb ()
Constructs a default Jsonb object. Equivalent to Jsonb("null").
Jsonb (const Jsonb &in)
Constructs a new Jsonb object from an existing Jsonb object (deep copy).
Jsonb (JsonbContainer *in, int len)
Constructs a new Jsonb object from a JsonbContainer with length.
Jsonb (const char *jsonString)
Constructs a new Jsonb object from a JSON string.
Jsonb (const char *jsonString, int len)
Constructs a new Jsonb object from a JSON string with length.
int fill (char *ptr) const
Fills ptr with the data of this object.
Jsonb clone () const
Makes a (deep) copy of this object.
JbvType type () const
Type of this JSON document.
const char * typeName () const
Type name of this JSON document.
Jsonb get (const char *key) const
Gets JSON value by key.
Jsonb get (int index) const
Gets JSON element by index.
Jsonb get (const Jsonb &path) const
Gets JSON element by path.
char * toString () const
Converts to string.
char * pretty () const
Converts to indented string.
bool toBool () const
Converts to bool.
int8 toInt8 () const
Converts to int8.
int16 toInt16 () const
Converts to int16.
int32 toInt32 () const
Converts to int32.
int64 toInt64 () const
Converts to int64.
float toFloat () const
Converts to float.
double toDouble () const
Converts to double.
int arrayLength () const
Number of elements in this JSON array (if it is a JSON array).
bool contains (const Jsonb &other) const
Checks if this JSON document is a superset of another JSON document.
bool contains (const char *other) const
Checks if this JSON document is a superset of another JSON document.
bool contained (const Jsonb &other) const
Checks if this JSON document is a subset of another JSON document.
bool contained (const char *other) const
Checks if this JSON document is a subset of another JSON document.
bool exists (const char *key) const
Checks if a key exists in this JSON document.
NullableBool exists (const JsonPath &path) const
Checks if JsonPath query returns any item.
NullableBool exists (const JsonPath &path, bool silent) const
Checks if JsonPath query returns any item.
NullableBool exists (const JsonPath &path, const Jsonb &vars) const
Checks if JsonPath query returns any item.
NullableBool exists (const JsonPath &path, const Jsonb &vars, bool silent) const
Checks if JsonPath query returns any item.
bool existsAny (const Jsonb &keys) const
Checks if any of the provided keys exists in this JSON document. More...
bool existsAny (const Jsonb &keys, bool silent) const
Checks if any of the provided keys exists in this JSON document.
bool existsAny (const char *keys) const
Checks if any of the provided keys exists in this JSON document.
bool existsAny (const char *keys, bool silent) const
Checks if any of the provided keys exists in this JSON document.
bool existsAll (const Jsonb &keys) const
Checks if all provided keys exist in this JSON document.
bool existsAll (const Jsonb &keys, bool silent) const
Checks if all provided keys exist in this JSON document.
bool existsAll (const char *keys) const
Checks if all provided keys exist in this JSON document.
bool existsAll (const char *keys, bool silent) const
Checks if all provided keys exist in this JSON document.
Jsonb & stripNulls ()
Recursively removes all key - value pairs whose value is null from a JSON object.
Jsonb & insert (const Jsonb &path, const Jsonb &value)
Inserts a new value into this JSON document.
Jsonb & insert (const char *path, const Jsonb &value)
Inserts a new value into this JSON document.
Jsonb & insert (const Jsonb &path, const char *value)
Inserts a new value into this JSON document.
Jsonb & insert (const char *path, const char *value)
Inserts a new value into this JSON document.
Jsonb & insert (const Jsonb &path, const Jsonb &value, bool after)
Inserts a new value into this JSON document.
Jsonb & insert (const char *path, const Jsonb &value, bool after)
Inserts a new value into this JSON document.
Jsonb & insert (const Jsonb &path, const char *value, bool after)
Inserts a new value into this JSON document.
Jsonb & insert (const char *path, const char *value, bool after)
Inserts a new value into this JSON document.
Jsonb & set (const Jsonb &path, const Jsonb &value)
Sets value for an element identified by path.
Jsonb & set (const char *path, const Jsonb &value)
Sets value for an element identified by path.
Jsonb & set (const Jsonb &path, const char *value)
Sets value for an element identified by path.
Jsonb & set (const char *path, const char *value)
Sets value for an element identified by path.
Jsonb & set (const Jsonb &path, const Jsonb &value, bool create)
Sets value for an element identified by path.
Jsonb & set (const char *path, const Jsonb &value, bool create)
Sets value for an element identified by path.
Jsonb & set (const Jsonb &path, const char *value, bool create)
Sets value for an element identified by path.
Jsonb & set (const char *path, const char *value, bool create)
Sets value for an element identified by path.
Jsonb & remove (const char *key)
Removes a key - value pair from a JSON object using key.
Jsonb & remove (int index)
Removes an element from a JSON array using index.
Jsonb & removeArray (const Jsonb &keys)
Removes multiple key - value pairs from a JSON object using an array of keys.
Jsonb & removeArray (const char *keys)
Removes multiple key - value pairs from a JSON object using an array of keys.
Jsonb & removePath (const Jsonb &path)
Removes an JSON element identified by path.
Jsonb & removePath (const char *path)
Removes an JSON element identified by path.
NullableBool match (const JsonPath &path) const
Returns the result of JsonPath predicate check.
NullableBool match (const JsonPath &path, bool silent) const
Returns the result of JsonPath predicate check.
NullableBool match (const JsonPath &path, const Jsonb &vars) const
Returns the result of JsonPath predicate check.
NullableBool match (const JsonPath &path, const Jsonb &vars, bool silent) const
Returns the result of JsonPath predicate check.
int query (const JsonPath &path, Jsonb &out) const
Gets all JSON elements returned by JsonPath query and wraps result into an array (alias to queryArray()).
int 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()).
int 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()).
int 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()).
bool queryFirst (const JsonPath &path, Jsonb &out) const
Gets the first JSON element returned by JsonPath query.
bool queryFirst (const JsonPath &path, Jsonb &out, bool silent) const
Gets the first JSON element returned by JsonPath query.
bool queryFirst (const JsonPath &path, Jsonb &out, const Jsonb &vars) const
Gets the first JSON element returned by JsonPath query.
bool queryFirst (const JsonPath &path, Jsonb &out, const Jsonb &vars, bool silent) const
Gets the first JSON element returned by JsonPath query.
int queryArray (const JsonPath &path, Jsonb &out) const
Gets all JSON elements returned by JsonPath query and wraps result into an array.
int queryArray (const JsonPath &path, Jsonb &out, bool silent) const
Gets all JSON elements returned by JsonPath query and wraps result into an array.
int queryArray (const JsonPath &path, Jsonb &out, const Jsonb &vars) const
Gets all JSON elements returned by JsonPath query and wraps result into an array.
int 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.
bool operator== (const Jsonb &rhs) const
Equality operator.
bool operator== (const char *rhs) const
Equality operator.
bool operator!= (const Jsonb &rhs) const
Inequality operator.
bool operator!= (const char *rhs) const
Inequality operator.
bool operator> (const Jsonb &rhs) const
Greater than operator.
bool operator> (const char *rhs) const
Greater than operator.
bool operator>= (const Jsonb &rhs) const
Greater than or equal operator.
bool operator>= (const char *rhs) const
Greater than or equal operator.
bool operator< (const Jsonb &rhs) const
Less than operator.
bool operator< (const char *rhs) const
Less than operator.
bool operator<= (const Jsonb &rhs) const
Less than or equal operator.
bool operator<= (const char *rhs) const
Less than or equal operator.
Jsonb operator+ (const Jsonb &rhs) const
Concatemates this JSON document with another JSON document.
Jsonb operator+ (const char *rhs) const
Concatemates this JSON document with another JSON document.
Jsonb & operator+= (const Jsonb &rhs)
Concatemates this JSON document with another JSON document and assigns the result back to this.
Jsonb & operator+= (const char *rhs)
Concatemates this JSON document with another JSON document and assigns the result back to this.
Jsonb operator- (int rhs) const
Removes an element from a JSON array using index.
Jsonb operator- (const char *rhs) const
Removes a key - value pair from a JSON object using key.
Jsonb & operator-= (int rhs)
Removes an element from a JSON array using index and assigns the result back to this.
Jsonb & operator-= (const char *rhs)
Removes a key - value pair from a JSON object using key and assigns the result back to this.
Jsonb & operator= (const Jsonb &rhs)
Assignment operator.
Jsonb operator[] (int index) const
Gets JSON element by index.
Jsonb operator[] (const char *key) const
Gets JSON value by key.

Static public member functions

static int cmp (const Jsonb &lhs, const Jsonb &rhs)
Compares two JSON documents.
static Jsonb concat (const Jsonb &a, const Jsonb &b)
Concatenates two JSON documents.
static Jsonb concat (const char *a, const Jsonb &b)
Concatenates two JSON documents.
static Jsonb concat (const Jsonb &a, const char *b)
Concatenates two JSON documents.
static Jsonb concat (const char *a, const char *b)
Concatenates two JSON documents.

Friends

class Json
bool operator== (const char *lhs, const Jsonb &rhs)
Jsonb equality operator.
bool operator!= (const char *lhs, const Jsonb &rhs)
Jsonb inequality operator.
bool operator> (const char *lhs, const Jsonb &rhs)
Jsonb greater than operator.
bool operator>= (const char *lhs, const Jsonb &rhs)
Jsonb greater than or equal operator.
bool operator< (const char *lhs, const Jsonb &rhs)
Less than operator.
bool operator<= (const char *lhs, const Jsonb &rhs)
Jsonb less than or equal operator.
Jsonb operator+ (const char *lhs, const Jsonb &rhs)
Concatemates two JSON documents.