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 /* implementation-defined */::json_base_class<CustomBaseClass>
Description
a class to store JSON values
Base Classes
Name |
Description |
|
Type Aliases
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 |
|
default object key comparator type The actual object key comparator type ( |
|
a type to represent differences between iterators |
|
how to treat decoding errors |
|
exception base class, see |
|
helper type for initializer lists of basic_json values |
|
the supported input formats for the |
|
exception indicating errors with iterators |
|
an iterator for a basic_json container |
|
JSON Pointer, see |
|
SAX interface type, see |
|
the type used to serialize/deserialize values of type T, 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 |
|
exception indicating other library errors |
|
exception indicating access out of the defined range |
|
exception indicating a parse error |
|
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 |
|
exception indicating executing a member function with a wrong type |
|
the type of an element's value, see |
|
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 a json_ref wrapper |
|
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, with bounds checking |
|
access specified element via JSON Pointer, with bounds checking |
|
access specified object element with bounds checking |
|
access specified object element with bounds checking |
|
|
access specified element via JSON Pointer, with bounds checking |
|
access specified element via JSON Pointer, 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 given a JSON pointer |
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) |
|
get a value (explicit) |
|
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 |
|
|
access specified element via JSON Pointer |
|
access specified element via JSON Pointer |
access specified object element |
|
access specified object element |
|
access specified object element |
|
access specified object element |
|
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 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 |
|
get a value (implicit) |
|
return the type of the JSON value (implicit) |
|
comparison: equal |
|
comparison: 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 |
|
check if the input is valid JSON (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
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 (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
|
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 BSON format |
create a JSON value from an input in BSON format (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
|
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 CBOR format |
create a JSON value from an input in CBOR format (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
|
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 MessagePack format |
create a JSON value from an input in MessagePack format (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
|
create a JSON value from an input in UBJSON format |
create a JSON value from an input in UBJSON format |
|
|
create a JSON value from an input in UBJSON format |
create a JSON value from an input in UBJSON format (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
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 compatible input |
|
deserialize from a pair of character iterators (or an iterator+sentinel pair, C++20 ranges support) |
|
|
generate SAX events |
generate SAX events |
|
generate SAX events (iterator pair, or iterator+sentinel pair for C++20 ranges support) |
|
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 |
|
|
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
Non-Member Functions
Name |
Description |
user‐defined format_as function for JSON values (fmt <= 11.0.x support) |
|
deserialize from stream |
|
serialize to stream |
|
user‐defined to_string function for JSON values |
Created with MrDocs