|
|
| JsonObject () |
| | Constructs an empty JSON object.
|
| |
|
int | size () const |
| | Returns the number of key-value pairs in the object.
|
| |
|
bool | isValid () const |
| | Returns true if the object contains at least one key-value pair.
|
| |
| bool | valueIsNull (const String &key) const |
| | Returns true if the value for the given key is null.
|
| |
| bool | valueIsObject (const String &key) const |
| | Returns true if the value for the given key is a JSON object.
|
| |
| bool | valueIsArray (const String &key) const |
| | Returns true if the value for the given key is a JSON array.
|
| |
| bool | contains (const String &key) const |
| | Returns true if the object contains the given key.
|
| |
| bool | getBool (const String &key, Error *err=nullptr) const |
| | Returns the boolean value for the given key.
|
| |
| int64_t | getInt (const String &key, Error *err=nullptr) const |
| | Returns the signed 64-bit integer value for the given key.
|
| |
| uint64_t | getUInt (const String &key, Error *err=nullptr) const |
| | Returns the unsigned 64-bit integer value for the given key.
|
| |
| double | getDouble (const String &key, Error *err=nullptr) const |
| | Returns the double-precision floating-point value for the given key.
|
| |
| String | getString (const String &key, Error *err=nullptr) const |
| | Returns the string value for the given key.
|
| |
| JsonObject | getObject (const String &key, Error *err=nullptr) const |
| | Returns the nested JsonObject for the given key.
|
| |
| JsonArray | getArray (const String &key, Error *err=nullptr) const |
| | Returns the nested JsonArray for the given key.
|
| |
| String | toString (unsigned int indent=0) const |
| | Serializes the object to a JSON string.
|
| |
|
void | clear () |
| | Removes all key-value pairs from the object.
|
| |
| void | setNull (const String &key) |
| | Sets the value for the given key to null.
|
| |
| void | set (const String &key, const JsonObject &val) |
| | Sets a nested JsonObject value for the given key.
|
| |
| void | set (const String &key, const JsonArray &val) |
| | Sets a nested JsonArray value for the given key.
|
| |
|
void | set (const String &key, bool val) |
| | Sets a boolean value for the given key.
|
| |
|
void | set (const String &key, int val) |
| | Sets an int value for the given key.
|
| |
|
void | set (const String &key, unsigned int val) |
| | Sets an unsigned int value for the given key.
|
| |
|
void | set (const String &key, int64_t val) |
| | Sets a signed 64-bit integer value for the given key.
|
| |
|
void | set (const String &key, uint64_t val) |
| | Sets an unsigned 64-bit integer value for the given key.
|
| |
|
void | set (const String &key, float val) |
| | Sets a float value for the given key.
|
| |
|
void | set (const String &key, double val) |
| | Sets a double value for the given key.
|
| |
|
void | set (const String &key, const char *val) |
| | Sets a C-string value for the given key.
|
| |
|
void | set (const String &key, const String &val) |
| | Sets a String value for the given key.
|
| |
|
void | set (const String &key, const UUID &val) |
| | Sets a UUID value (stored as its string representation) for the given key.
|
| |
| void | setFromVariant (const String &key, const Variant &val) |
| | Sets a value from a Variant, automatically selecting the JSON type.
|
| |
| template<typename Func > |
| void | forEach (Func &&func) const |
| | Iterates over all key-value pairs in the object.
|
| |
|
bool | operator== (const JsonObject &other) const |
| | Returns true if both JSON objects have identical contents.
|
| |
JSON object container wrapping nlohmann::json.
Provides a type-safe interface for building and querying JSON objects.
- Example
JSON object container wrapping nlohmann::json.
Definition json.h:44
static JsonObject parse(const String &str, Error *err=nullptr)
Parses a JSON object from a string.
Definition json.h:56
Dynamic array container wrapping std::vector.
Definition list.h:40
bool set(size_t index, const T &val)
Sets an item in the list by index.
Definition list.h:541
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
Values can be accessed by key with typed getters that perform safe conversions. Supports nesting via JsonObject and JsonArray values.