a class to store JSON values
Synopsis
Declared in <nlohmann/json.hpp>
template<
    template<
    typename U,
    typename V,
    typename... Args> typename ObjectType = map,
    template<
    typename U,
    typename... Args> typename ArrayType = vector,
    class StringType = std::string,
    class BooleanType = bool,
    class NumberIntegerType = int64_t,
    class NumberUnsignedType = uint64_t,
    class NumberFloatType = double,
    template<typename U> typename AllocatorType = allocator,
    template<
    typename T,
    typename SFINAE = void> typename JSONSerializer = adl_serializer,
    class BinaryType = std::vector<uint8_t>,
    class CustomBaseClass = void>
class basic_json
    : public nlohmann::detail::json_base_class<CustomBaseClass>Base Classes
| Name | Description | 
| 
 | 
Types
| Name | Description | 
| the allocator type | |
| a type for an array | |
| a type for a packed binary type | |
| how to encode BJData | |
| a type for a boolean | |
| how to treat CBOR tags | |
| a const iterator for a basic_json container | |
| the type of an element const pointer | |
| the type of an element const reference | |
| a const reverse iterator for a basic_json container | |
| a type to represent differences between iterators | |
| how to treat decoding errors | |
| Classes to implement user‐defined exceptions. @{ | |
| helper type for initializer lists of basic_json values | |
| an iterator for a basic_json container | |
| JSON Pointer, see  | |
| SAX interface type, see  | |
| a type for a number (floating‐point) | |
| a type for a number (integer) | |
| a type for a number (unsigned) | |
| object key comparator type | |
| a type for an object | |
| parser event types | |
| per‐element parser callback type | |
| the type of an element pointer | |
| the type of an element reference | |
| a reverse iterator for a basic_json container | |
| a type to represent container sizes | |
| a type for a string | |
| the type of elements in a basic_json container | 
Member Functions
| Name | Description | 
| 
 | copy constructor | 
| 
 | move constructor | 
| 
 | create a null object | 
| 
 | create an empty value with a given type | 
| 
 | create a JSON value from an existing one | 
| 
 | //////////////////////////////////// | 
| 
 | create a JSON value from compatible types | 
| 
 | construct an array with count copies of given value | 
| 
 | construct a JSON container given an iterator range | 
| 
 | create a container (array or object) from an initializer list | 
| 
 | destructor | 
| copy assignment | |
| access specified array element with bounds checking | |
| access specified array element with bounds checking | |
| access specified element via JSON Pointer | |
| access specified element via JSON Pointer | |
| access specified object element with bounds checking | |
| access specified object element with bounds checking | |
| access specified object element with bounds checking | |
| access specified object element with bounds checking | |
| access the last element | |
| access the last element | |
| returns an iterator to the first element | |
| returns an iterator to the first element | |
| returns a const iterator to the first element | |
| returns an iterator to one past the last element | |
| clears the contents | |
| check the existence of an element in a JSON object given a JSON pointer | |
| check the existence of an element in a JSON object | |
| check the existence of an element in a JSON object | |
| returns the number of occurrences of a key in a JSON object | |
| returns the number of occurrences of a key in a JSON object | |
| returns a const reverse iterator to the last element | |
| returns a const reverse iterator to one before the first | |
| serialization | |
| add an object to an object if key does not exist | |
| add an object to an array | |
| checks whether the container is empty. | |
| returns an iterator to one past the last element | |
| returns an iterator to one past the last element | |
| remove element from a JSON array given an index | |
| remove element from a JSON object given a key | |
| remove element given an iterator | |
| remove element from a JSON object given a key | |
| remove elements given an iterator range | |
| find an element in a JSON object | |
| find an element in a JSON object | |
| find an element in a JSON object | |
| find an element in a JSON object | |
| return flattened JSON value | |
| access the first element | |
| access the first element | |
| get a pointer value (explicit) | |
| get a (pointer) value (explicit) | |
| get a binary value | |
| get a binary value | |
| get a pointer value (implicit) | |
| get a pointer value (implicit) | |
| get a reference value (implicit) | |
| get a reference value (implicit) | |
| get a value (explicit) | |
| inserts range of elements into object | |
| inserts elements from initializer list into array | |
| inserts element into array | |
| inserts element into array | |
| inserts range of elements into array | |
| inserts copies of element into array | |
| Helper for insertion of an iterator | |
| return whether value is an array | |
| return whether value is a binary array | |
| return whether value is a boolean | |
| return whether value is discarded | |
| return whether value is null | |
| return whether value is a number | |
| return whether value is a floating‐point number | |
| return whether value is an integer number | |
| return whether value is an unsigned integer number | |
| return whether value is an object | |
| return whether type is primitive | |
| return whether value is a string | |
| return whether type is structured | |
| helper to access iterator member functions in range‐based for | |
| helper to access iterator member functions in range‐based for | |
| returns the maximum possible number of elements | |
| applies a JSON Merge Patch | |
| add an object to an object | |
| add an object to an array | |
| add an object to an object | |
| add an object to an array | |
| access specified object element | |
| access specified array element | |
| access specified array element | |
| access specified element via JSON Pointer | |
| access specified element via JSON Pointer | |
| access specified object element | |
| Subscript operator | |
| Subscript operator | |
| access specified object element | |
| access specified object element | |
| Subscript operator | |
| Subscript operator | |
| applies a JSON patch to a copy of the current object | |
| applies a JSON patch in‐place without copying the object | |
| add an object to an object | |
| add an object to an array | |
| add an object to an object | |
| add an object to an array | |
| returns an iterator to the reverse‐beginning | |
| returns an iterator to the reverse‐beginning | |
| returns an iterator to the reverse‐end | |
| returns an iterator to the reverse‐end | |
| returns the number of elements | |
| exchanges the values | |
| exchanges the values | |
| exchanges the values | |
| exchanges the values | |
| exchanges the values | |
| exchanges the values | |
| return the type of the JSON value (explicit) | |
| return the type as string | |
| unflatten a previously flattened JSON value | |
| updates a JSON object from another object, overwriting existing keys | |
| updates a JSON object from another object, overwriting existing keys | |
| access specified object element via JSON Pointer with default value | |
| access specified object element with default value | |
| access specified object element via JSON Pointer with default value | |
| access specified object element with default value | |
| access specified object element with default value | |
| access specified object element via JSON Pointer with default value | |
| get a value (implicit) | |
| return the type of the JSON value (implicit) | |
| comparison: equal | |
| comparison: equal | |
| comparison: not equal | |
| comparison: 3‐way | |
| comparison: 3‐way | 
Static Member Functions
| Name | Description | 
| check if the input is valid JSON | |
| check if the input is valid JSON | |
| explicitly create an array from an initializer list | |
| explicitly create a binary array (without subtype) | |
| explicitly create a binary array | |
| explicitly create a binary array (with subtype) | |
| explicitly create a binary array (with subtype) | |
| creates a diff as a JSON patch | |
| create a JSON value from an input in BJData format | |
| create a JSON value from an input in BJData format | |
| create a JSON value from an input in BSON format | |
| create a JSON value from an input in BSON format | |
| create a JSON value from an input in CBOR format | |
| create a JSON value from an input in CBOR format | |
| create a JSON value from an input in MessagePack format | |
| create a JSON value from an input in MessagePack format | |
| create a JSON value from an input in UBJSON format | |
| create a JSON value from an input in UBJSON format | |
| returns the allocator associated with the container | |
| wrapper to access iterator member functions in range‐based for | |
| wrapper to access iterator member functions in range‐based for | |
| returns version information on the library | |
| explicitly create an object from an initializer list | |
| deserialize from a compatible input | |
| deserialize from a pair of character iterators | |
| generate SAX events | |
| generate SAX events | |
| generate SAX events | |
| create a BJData serialization of a given JSON value | |
| create a BJData serialization of a given JSON value | |
| create a BJData serialization of a given JSON value | |
| create a BSON serialization of a given JSON value | |
| create a BSON serialization of a given JSON value | |
| create a BSON serialization of a given JSON value | |
| create a CBOR serialization of a given JSON value | |
| create a CBOR serialization of a given JSON value | |
| create a CBOR serialization of a given JSON value | |
| create a MessagePack serialization of a given JSON value | |
| create a MessagePack serialization of a given JSON value | |
| create a MessagePack serialization of a given JSON value | |
| create a UBJSON serialization of a given JSON value | |
| create a UBJSON serialization of a given JSON value | |
| create a UBJSON serialization of a given JSON value | 
Friends
| Name | Description | 
| deserialize from stream | |
| deserialize from stream | |
| serialize to stream | |
| serialize to stream | |
| exchanges the values | |
| 
 | general exception of the  | 
| 
 | |
Non-Member Functions
| Name | Description | 
| deserialize from stream | |
| serialize to stream | |
| user‐defined to_string function for JSON values | 
Description
a class to store JSON values
@invariant The member variables @a m_value and @a m_type have the following
relationship:
- If `m_type == value_t::object`, then `m_value.object != nullptr`.
- If `m_type == value_t::array`, then `m_value.array != nullptr`.
- If `m_type == value_t::string`, then `m_value.string != nullptr`.
The invariants are checked by member function assert_invariant().
@note ObjectType trick from https://stackoverflow.com/a/9860911Created with MrDocs