Name | Description |
---|---|
nlohmann | namespace for Niels Lohmann |
Name |
---|
Unnamed using |
Unnamed using |
namespace for Niels Lohmann
Name | Description |
---|---|
adl_serializer | default JSONSerializer template argument |
basic_json<> | |
basic_json | a class to store JSON values |
byte_container_with_subtype | an internal type for a backed binary type |
byte_container_with_subtype<vector<unsigned char>> | |
json_pointer | |
json_pointer | JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
ordered_map | a minimal map-like container that preserves insertion order |
json | default specialization |
ordered_json | specialization that maintains the insertion order of object keys |
Name | Description |
---|---|
Unnamed overloads | |
operator>> | Right shift operators |
swap | exchanges the values |
to_string | user-defined to_string function for JSON values |
operator<< | Left shift operators |
https://github.com/nlohmann
namespace for Niels Lohmann
Name | Description |
---|---|
adl_serializer | default JSONSerializer template argument |
basic_json<> | |
basic_json | a class to store JSON values |
byte_container_with_subtype | an internal type for a backed binary type |
byte_container_with_subtype<vector<unsigned char>> | |
json_pointer | |
json_pointer | JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
ordered_map | a minimal map-like container that preserves insertion order |
json | default specialization |
ordered_json | specialization that maintains the insertion order of object keys |
Name | Description |
---|---|
Unnamed overloads | |
operator>> | Right shift operators |
swap | exchanges the values |
to_string | user-defined to_string function for JSON values |
operator<< | Left shift operators |
https://github.com/nlohmann
default specialization
specialization that maintains the insertion order of object keys
default JSONSerializer template argument
<nlohmann/adl_serializer.hpp>
template<
typename T = void,
typename SFINAE = void>
struct adl_serializer;
Name | Description |
---|---|
from_json | convert a JSON value to any value type |
to_json | convert any value type to a JSON value |
This serializer ignores the template arguments and uses ADL(argument-dependent lookup)for serialization.
convert a JSON value to any value type
<nlohmann/adl_serializer.hpp>
convert a JSON value to any value type
template<
typename BasicJsonType,
typename TargetType = ValueType>
static
decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
from_json(BasicJsonType&& j) noexcept(noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType>{})));
» more...
convert a JSON value to any value type
template<
typename BasicJsonType,
typename TargetType = ValueType>
static
decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
from_json(
BasicJsonType&& j,
TargetType& val) noexcept(noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)));
» more...
convert a JSON value to any value type
<nlohmann/adl_serializer.hpp>
template<
typename BasicJsonType,
typename TargetType = ValueType>
static
decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
from_json(BasicJsonType&& j) noexcept(noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType>{})));
convert a JSON value to any value type
<nlohmann/adl_serializer.hpp>
template<
typename BasicJsonType,
typename TargetType = ValueType>
static
decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
from_json(
BasicJsonType&& j,
TargetType& val) noexcept(noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)));
convert any value type to a JSON value
<nlohmann/adl_serializer.hpp>
template<
typename BasicJsonType,
typename TargetType = ValueType>
static
decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
to_json(
BasicJsonType& j,
TargetType&& val) noexcept(noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))));
<nlohmann/json.hpp>
template<>
class basic_json<>
: public nlohmann::detail::json_base_class<void>
Name | Description |
---|---|
nlohmann::detail::json_base_class<void> |
Name | Description |
---|---|
allocator_type | the allocator type |
array_t | a type for an array |
binary_t | a type for a packed binary type |
bjdata_version_t | how to encode BJData |
boolean_t | a type for a boolean |
cbor_tag_handler_t | how to treat CBOR tags |
const_iterator | a const iterator for a basic_json container |
const_pointer | the type of an element const pointer |
const_reference | the type of an element const reference |
const_reverse_iterator | a const reverse iterator for a basic_json container |
default_object_comparator_t | |
difference_type | a type to represent differences between iterators |
error_handler_t | how to treat decoding errors |
exception | Classes to implement user-defined exceptions. @{ |
initializer_list_t | helper type for initializer lists of basic_json values |
input_format_t | |
invalid_iterator | |
iterator | an iterator for a basic_json container |
json_pointer | JSON Pointer, see nlohmann::json_pointer |
json_sax_t | SAX interface type, see nlohmann::json_sax |
json_serializer | |
number_float_t | a type for a number (floating-point) |
number_integer_t | a type for a number (integer) |
number_unsigned_t | a type for a number (unsigned) |
object_comparator_t | object key comparator type |
object_t | a type for an object |
other_error | |
out_of_range | |
parse_error | |
parse_event_t | parser event types |
parser_callback_t | per-element parser callback type |
pointer | the type of an element pointer |
reference | the type of an element reference |
reverse_iterator | a reverse iterator for a basic_json container |
size_type | a type to represent container sizes |
string_t | a type for a string |
type_error | |
value_t | |
value_type | the type of elements in a basic_json container |
Name | Description |
---|---|
basic_json [constructor] | Construct from nullptr_t |
basic_json [constructor] | Construct from value_t |
basic_json [constructor] | Construct from basic_json |
basic_json [constructor] | Construct from basic_json |
basic_json [constructor] | create a JSON value from an existing one |
basic_json [constructor] | //////////////////////////////////// |
basic_json [constructor] | create a JSON value from compatible types |
basic_json [constructor] | Constructor |
basic_json [constructor] | construct a JSON container given an iterator range |
basic_json [constructor] | |
~basic_json [destructor] | Destructor |
operator= | Assignment operator |
at | |
at | |
at | |
at | |
at | |
at | |
at | |
at | |
at | access specified object element with bounds checking |
at | access specified object element with bounds checking |
back | |
back | |
begin | |
begin | |
cbegin | |
cend | |
clear | |
contains | |
contains | |
contains | |
contains | check the existence of an element in a JSON object |
count | |
count | returns the number of occurrences of a key in a JSON object |
crbegin | |
crend | |
dump | |
emplace | add an object to an object if key does not exist |
emplace_back | add an object to an array |
empty | |
end | |
end | |
erase | |
erase | |
erase | remove element given an iterator |
erase | remove element from a JSON object given a key |
erase | remove elements given an iterator range |
find | |
find | |
find | find an element in a JSON object |
find | find an element in a JSON object |
flatten | |
front | |
front | |
get | get a pointer value (explicit) |
get | get a (pointer) value (explicit) |
get_binary | |
get_binary | |
get_ptr | get a pointer value (implicit) |
get_ptr | get a pointer value (implicit) |
get_ref | get a reference value (implicit) |
get_ref | get a reference value (implicit) |
get_to | get a value (explicit) |
get_to | |
get_to | |
insert | |
insert | |
insert | |
insert | |
insert | |
insert | |
insert_iterator | Helper for insertion of an iterator |
is_array | |
is_binary | |
is_boolean | |
is_discarded | |
is_null | |
is_number | |
is_number_float | |
is_number_integer | |
is_number_unsigned | |
is_object | |
is_primitive | |
is_string | |
is_structured | |
items | |
items | |
max_size | |
merge_patch | |
operator+= | Addition assignment operator |
operator+= | Addition assignment operator |
operator+= | Addition assignment operator |
operator+= | Addition assignment operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | access specified object element |
operator[] | access specified object element |
operator[] | Subscript operator |
operator[] | Subscript operator |
patch | |
patch_inplace | |
push_back | |
push_back | |
push_back | |
push_back | |
rbegin | |
rbegin | |
rend | |
rend | |
size | |
swap | |
swap | |
swap | |
swap | |
swap | |
swap | |
type | |
type_name | |
unflatten | |
update | |
update | |
value | access specified object element via JSON Pointer with default value |
value | access specified object element with default value |
value | access specified object element via JSON Pointer with default value |
value | access specified object element with default value |
value | |
value | access specified object element with default value |
value | |
value | access specified object element via JSON Pointer with default value |
operator ValueType | get a value (implicit) |
operator value_t | Conversion to value_t |
operator== | comparison: equal |
operator== | Equality operator |
operator!= | Inequality operator |
operator<=> | comparison: 3-way |
operator<=> | Three-way comparison operator |
Name | Description |
---|---|
accept | |
accept | check if the input is valid JSON |
accept | check if the input is valid JSON |
array | |
binary | |
binary | |
binary | |
binary | |
diff | |
from_bjdata | create a JSON value from an input in BJData format |
from_bjdata | create a JSON value from an input in BJData format |
from_bson | |
from_bson | create a JSON value from an input in BSON format |
from_bson | create a JSON value from an input in BSON format |
from_bson | |
from_cbor | |
from_cbor | create a JSON value from an input in CBOR format |
from_cbor | create a JSON value from an input in CBOR format |
from_cbor | |
from_msgpack | |
from_msgpack | create a JSON value from an input in MessagePack format |
from_msgpack | create a JSON value from an input in MessagePack format |
from_msgpack | |
from_ubjson | |
from_ubjson | create a JSON value from an input in UBJSON format |
from_ubjson | create a JSON value from an input in UBJSON format |
from_ubjson | |
get_allocator | |
iterator_wrapper | |
iterator_wrapper | |
meta | |
object | |
parse | |
parse | deserialize from a compatible input |
parse | deserialize from a pair of character iterators |
sax_parse | generate SAX events |
sax_parse | generate SAX events |
sax_parse | generate SAX events |
to_bjdata | |
to_bjdata | |
to_bjdata | |
to_bson | |
to_bson | |
to_bson | |
to_cbor | |
to_cbor | |
to_cbor | |
to_msgpack | |
to_msgpack | |
to_msgpack | |
to_ubjson | |
to_ubjson | |
to_ubjson |
Name | Description |
---|---|
operator>> |
deserialize from stream |
operator<< |
deserialize from stream |
operator>> |
serialize to stream |
operator<< |
serialize to stream |
swap |
exchanges the values |
exception |
general exception of the basic_json class |
serializer |
|
json_pointer |
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
the allocator type
<nlohmann/json.hpp>
using allocator_type = allocator<basic_json>;
a type for an array
<nlohmann/json.hpp>
using array_t = vector<basic_json, allocator<basic_json>>;
a type for a packed binary type
<nlohmann/json.hpp>
using binary_t = nlohmann::byte_container_with_subtype<vector<unsigned char>>;
how to encode BJData
<nlohmann/json.hpp>
using bjdata_version_t = detail::bjdata_version_t;
a type for a boolean
<nlohmann/json.hpp>
using boolean_t = bool;
how to treat CBOR tags
<nlohmann/json.hpp>
using cbor_tag_handler_t = detail::cbor_tag_handler_t;
a const iterator for a basic_json container
the type of an element const pointer
<nlohmann/json.hpp>
using const_pointer = std::allocator_traits<allocator_type>::const_pointer;
the type of an element const reference
a const reverse iterator for a basic_json container
<nlohmann/json.hpp>
using const_reverse_iterator = json_reverse_iterator<basic_json::const_iterator>;
<nlohmann/json.hpp>
using default_object_comparator_t = std::less;
a type to represent differences between iterators
<nlohmann/json.hpp>
using difference_type = std::ptrdiff_t;
how to treat decoding errors
<nlohmann/json.hpp>
using error_handler_t = detail::error_handler_t;
Classes to implement user-defined exceptions. @{
<nlohmann/json.hpp>
using exception = detail::exception;
helper type for initializer lists of basic_json values
<nlohmann/json.hpp>
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
<nlohmann/json.hpp>
using input_format_t = detail::input_format_t;
<nlohmann/json.hpp>
using invalid_iterator = detail::invalid_iterator;
an iterator for a basic_json container
JSON Pointer, see nlohmann::json_pointer
<nlohmann/json.hpp>
using json_pointer = nlohmann::json_pointer<basic_string<char>>;
SAX interface type, see nlohmann::json_sax
<nlohmann/json.hpp>
using json_sax_t = json_sax<basic_json>;
<nlohmann/json.hpp>
template<
typename T,
typename SFINAE>
using json_serializer = adl_serializer<T, SFINAE>;
a type for a number (floating-point)
<nlohmann/json.hpp>
using number_float_t = double;
a type for a number (integer)
<nlohmann/json.hpp>
using number_integer_t = long long;
a type for a number (unsigned)
<nlohmann/json.hpp>
using number_unsigned_t = unsigned long long;
object key comparator type
<nlohmann/json.hpp>
using object_comparator_t = detail::actual_object_comparator_t<basic_json>;
a type for an object
<nlohmann/json.hpp>
using object_t = map<basic_string<char>, basic_json, default_object_comparator_t, allocator<std::pair<basic_string<char> const, basic_json>>>;
<nlohmann/json.hpp>
using other_error = detail::other_error;
<nlohmann/json.hpp>
using out_of_range = detail::out_of_range;
<nlohmann/json.hpp>
using parse_error = detail::parse_error;
parser event types
<nlohmann/json.hpp>
using parse_event_t = detail::parse_event_t;
per-element parser callback type
<nlohmann/json.hpp>
using parser_callback_t = detail::parser_callback_t<basic_json>;
the type of an element pointer
<nlohmann/json.hpp>
using pointer = std::allocator_traits<allocator_type>::pointer;
the type of an element reference
a reverse iterator for a basic_json container
<nlohmann/json.hpp>
using reverse_iterator = json_reverse_iterator<basic_json::iterator>;
a type to represent container sizes
<nlohmann/json.hpp>
using size_type = std::size_t;
a type for a string
<nlohmann/json.hpp>
using string_t = basic_string<char>;
<nlohmann/json.hpp>
using type_error = detail::type_error;
<nlohmann/json.hpp>
using value_t = detail::value_t;
the type of elements in a basic_json container
Construct from nullptr_t
<nlohmann/json.hpp>
basic_json(std::nullptr_t value = nullptr) noexcept;
Name | Description |
---|---|
value | The object to construct from |
Construct from value_t
Name | Description |
---|---|
v | The object to construct from |
Construct from basic_json
Name | Description |
---|---|
other | The object to copy construct from |
Construct from basic_json
Name | Description |
---|---|
other | The object to move construct from |
create a JSON value from an existing one
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value&& !std::is_same<basic_json, BasicJsonType>::value
basic_json(BasicJsonType const& val);
Name | Description |
---|---|
val | The object to copy construct from |
////////////////////////////////////
<nlohmann/json.hpp>
template<typename JsonRef>
requires detail::conjunction<detail::is_json_ref<JsonRef>,
std::is_same<typename JsonRef::value_type, basic_json>>::value
basic_json(JsonRef const& ref);
Name | Description |
---|---|
ref | The object to copy construct from |
create a JSON value from compatible types
<nlohmann/json.hpp>
template<
typename CompatibleType,
typename U = detail::uncvref_t<CompatibleType>>
requires !detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value
basic_json(CompatibleType&& val) noexcept(noexcept(JSONSerializer<U, void>::to_json(std::declval<basic_json_t &>(), std::forward<CompatibleType>(val))));
Name | Description |
---|---|
val | The object to move construct from |
Constructor
Name | Description |
---|---|
cnt | The object to construct from |
val | a class to store JSON values |
construct a JSON container given an iterator range
<nlohmann/json.hpp>
template<class InputIT>
requires std::is_same<InputIT, typename basic_json_t::iterator>::value ||
std::is_same<InputIT, typename basic_json_t::const_iterator>::value
basic_json(
InputIT first,
InputIT last);
Name | Description |
---|---|
first | The object to construct from |
<nlohmann/json.hpp>
basic_json(
initializer_list_t init,
bool type_deduction = true,
value_t manual_type = value_t::array);
Destructor
<nlohmann/json.hpp>
~basic_json() noexcept;
Assignment operator
<nlohmann/json.hpp>
basic_json&
operator=(basic_json other) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value && std::is_nothrow_move_assignable<json_base_class_t>::value);
Name | Description |
---|---|
other | The object to assign from |
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
at(nlohmann::json_pointer<BasicJsonType> const& ptr);
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
const_reference
at(nlohmann::json_pointer<BasicJsonType> const& ptr) const;
access specified object element with bounds checking
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
at(KeyType&& key);
access specified object element with bounds checking
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
const_reference
at(KeyType&& key) const;
<nlohmann/json.hpp>
void
clear() noexcept;
<nlohmann/json.hpp>
bool
contains(object_t::key_type const& key) const;
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
bool
contains(nlohmann::json_pointer<BasicJsonType> const& ptr) const;
check the existence of an element in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
bool
contains(KeyType&& key) const;
returns the number of occurrences of a key in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
size_type
count(KeyType&& key) const;
<nlohmann/json.hpp>
string_t
dump(
int const indent = -1,
char const indent_char = ' ',
bool const ensure_ascii = false,
error_handler_t const error_handler = error_handler_t::strict) const;
add an object to an object if key does not exist
<nlohmann/json.hpp>
template<class... Args>
std::pair<iterator, bool>
emplace(Args...&&... args);
add an object to an array
<nlohmann/json.hpp>
template<class... Args>
reference
emplace_back(Args...&&... args);
<nlohmann/json.hpp>
bool
empty() const noexcept;
remove element given an iterator
<nlohmann/json.hpp>
template<class IteratorType>
requires std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
std::is_same<IteratorType, typename basic_json_t::const_iterator>::value
IteratorType
erase(IteratorType pos);
remove element from a JSON object given a key
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
size_type
erase(KeyType&& key);
remove elements given an iterator range
<nlohmann/json.hpp>
template<class IteratorType>
requires std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
std::is_same<IteratorType, typename basic_json_t::const_iterator>::value
IteratorType
erase(
IteratorType first,
IteratorType last);
find an element in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
iterator
find(KeyType&& key);
find an element in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
const_iterator
find(KeyType&& key) const;
get a pointer value (explicit)
<nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
get() noexcept;
Explicit pointer access to the internally stored JSON value. No copies are made.
The pointer becomes invalid if the underlying JSON object changes.
Constant.
{The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr
is returned if the value and the requested pointer type does not match.,get__PointerType}
nullptr
otherwise
Name | Description |
---|---|
PointerType | pointer type; must be a pointer to array_t , object_t , string_t , boolean_t , number_integer_t , number_unsigned_t , or number_float_t . |
get a (pointer) value (explicit)
<nlohmann/json.hpp>
template<
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>>
constexpr
decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
get() const noexcept(noexcept(std::declval<const basic_json_t &>().template get_impl<ValueType>(detail::priority_tag<4>{})));
Performs explicit type conversion between the JSON value and a compatible value if required.
- If the requested type is a pointer to the internally stored JSON value that pointer is returned. No copies are made.
- If the requested type is the current basic_json
, or a different basic_json
convertible from the current basic_json
.
- Otherwise the value is converted by calling the json_serializer<ValueType>
from_json()
method.
Name | Thrown on |
---|---|
what |
json_serializer<ValueType> from_json() method throws if conversion is required |
Name | Description |
---|---|
ValueTypeCV | the provided value type |
ValueType | the returned value type |
ValueType | if necessary |
get a pointer value (implicit)
<nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
get_ptr() noexcept;
get a pointer value (implicit)
<nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value&&
std::is_const<typename std::remove_pointer<PointerType>::type>::value
constexpr
decltype(std::declval<const basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
get_ptr() const noexcept;
get a reference value (implicit)
<nlohmann/json.hpp>
template<typename ReferenceType>
requires std::is_reference<ReferenceType>::value
ReferenceType
get_ref();
get a reference value (implicit)
<nlohmann/json.hpp>
template<typename ReferenceType>
requires std::is_reference<ReferenceType>::value&&
std::is_const<typename std::remove_reference<ReferenceType>::type>::value
ReferenceType
get_ref() const;
get a value (explicit)
<nlohmann/json.hpp>
template<typename ValueType>
requires !detail::is_basic_json<ValueType>::value&&
detail::has_from_json<basic_json_t, ValueType>::value
ValueType&
get_to(ValueType& v) const noexcept(noexcept(JSONSerializer<ValueType, void>::from_json(std::declval<const basic_json_t &>(), v)));
<nlohmann/json.hpp>
template<typename ValueType>
requires detail::is_basic_json<ValueType>::value
ValueType&
get_to(ValueType& v) const;
<nlohmann/json.hpp>
template<
typename T,
std::size_t N,
typename Array = T(&)[]>
requires detail::has_from_json<basic_json_t, Array>::value
Array
get_to(T(& v)[]) const noexcept(noexcept(JSONSerializer<Array, void>::from_json(std::declval<const basic_json_t &>(), v)));
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
initializer_list_t ilist);
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
basic_json const& val);
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
const_iterator first,
const_iterator last);
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
size_type cnt,
basic_json const& val);
Helper for insertion of an iterator
<nlohmann/json.hpp>
template<typename... Args>
iterator
insert_iterator(
const_iterator pos,
Args...&&... args);
: This uses std::distance to support GCC 4.8, see https://github.com/nlohmann/json/pull/1257
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
<nlohmann/json.hpp>
constexpr
bool
is_array() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_binary() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_boolean() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_discarded() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_null() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_number() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_number_float() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_number_integer() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_number_unsigned() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_object() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_primitive() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_string() const noexcept;
<nlohmann/json.hpp>
constexpr
bool
is_structured() const noexcept;
Addition assignment operator
Name | Description |
---|---|
init | The right operand |
Addition assignment operator
Name | Description |
---|---|
val | The right operand |
Addition assignment operator
Name | Description |
---|---|
val | The right operand |
Addition assignment operator
Name | Description |
---|---|
val | The right operand |
Subscript operator
Name | Description |
---|---|
key | The right operand |
Subscript operator
Name | Description |
---|---|
idx | The right operand |
Subscript operator
Name | Description |
---|---|
idx | The right operand |
Subscript operator
Name | Description |
---|---|
ptr | The right operand |
Subscript operator
Name | Description |
---|---|
ptr | The right operand |
Subscript operator
<nlohmann/json.hpp>
const_reference
operator[](object_t::key_type const& key) const;
Name | Description |
---|---|
key | The right operand |
Subscript operator
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr);
Name | Description |
---|---|
ptr | The right operand |
Subscript operator
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
const_reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr) const;
Name | Description |
---|---|
ptr | The right operand |
access specified object element
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
operator[](KeyType&& key);
Name | Description |
---|---|
key | The right operand |
access specified object element
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
const_reference
operator[](KeyType&& key) const;
Name | Description |
---|---|
key | The right operand |
Subscript operator
Name | Description |
---|---|
key | The right operand |
Subscript operator
<nlohmann/json.hpp>
template<typename T>
const_reference
operator[](T* key) const;
Name | Description |
---|---|
key | The right operand |
<nlohmann/json.hpp>
void
push_back(object_t::value_type const& val);
<nlohmann/json.hpp>
void
swap(reference other) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value);
<nlohmann/json.hpp>
[[__returns_nonnull__]]
char const*
type_name() const noexcept;
<nlohmann/json.hpp>
void
update(
const_reference j,
bool merge_objects = false);
<nlohmann/json.hpp>
void
update(
const_iterator first,
const_iterator last,
bool merge_objects = false);
access specified object element via JSON Pointer with default value
<nlohmann/json.hpp>
template<class ValueType>
requires detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
json_pointer const& ptr,
ValueType const& default_value) const;
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
access specified object element with default value
<nlohmann/json.hpp>
template<class ValueType>
requires !detail::is_transparent<object_comparator_t>::value
&& detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
object_t::key_type const& key,
ValueType const& default_value) const;
access specified object element via JSON Pointer with default value
<nlohmann/json.hpp>
template<
class ValueType,
class ReturnType = value_return_type<ValueType>::type>
requires detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ReturnType
value(
json_pointer const& ptr,
ValueType&& default_value) const;
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
access specified object element with default value
<nlohmann/json.hpp>
template<
class ValueType,
class ReturnType = value_return_type<ValueType>::type>
requires !detail::is_transparent<object_comparator_t>::value
&& detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ReturnType
value(
object_t::key_type const& key,
ValueType&& default_value) const;
<nlohmann/json.hpp>
template<
class ValueType,
class BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
&& detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
[[__deprecated__]]
ValueType
value(
nlohmann::json_pointer<BasicJsonType> const& ptr,
ValueType const& default_value) const;
access specified object element with default value
<nlohmann/json.hpp>
template<
class ValueType,
class KeyType>
requires detail::is_transparent<object_comparator_t>::value
&& !detail::is_json_pointer<KeyType>::value
&& is_comparable_with_object_key<KeyType>::value
&& detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
KeyType&& key,
ValueType const& default_value) const;
<nlohmann/json.hpp>
template<
class ValueType,
class BasicJsonType,
class ReturnType = value_return_type<ValueType>::type>
requires detail::is_basic_json<BasicJsonType>::value
&& detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
[[__deprecated__]]
ReturnType
value(
nlohmann::json_pointer<BasicJsonType> const& ptr,
ValueType&& default_value) const;
access specified object element via JSON Pointer with default value
<nlohmann/json.hpp>
template<
class ValueType,
class KeyType,
class ReturnType = value_return_type<ValueType>::type>
requires detail::is_transparent<object_comparator_t>::value
&& !detail::is_json_pointer<KeyType>::value
&& is_comparable_with_object_key<KeyType>::value
&& detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ReturnType
value(
KeyType&& key,
ValueType&& default_value) const;
get a value (implicit)
<nlohmann/json.hpp>
template<typename ValueType>
requires detail::conjunction <
detail::negation<std::is_pointer<ValueType>>,
detail::negation<std::is_same<ValueType, std::nullptr_t>>,
detail::negation<std::is_same<ValueType, detail::json_ref<basic_json>>>,
detail::negation<std::is_same<ValueType, typename string_t::value_type>>,
detail::negation<detail::is_basic_json<ValueType>>,
detail::negation<std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>>,
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
detail::negation<std::is_same<ValueType, std::string_view>>,
#endif
#if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI
detail::negation<std::is_same<ValueType, std::any>>,
#endif
detail::is_detected_lazy<detail::get_template_function, const basic_json_t&, ValueType>
>::value
operator ValueType() const;
Implicit type conversion between the JSON value and a compatible value. The call is realized by calling get() const
.
Linear in the size of the JSON value.
{The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard std::vector<short>
, (3) A JSON object can be converted to C++ associative containers such as std::unordered_map<std::string\, json>
.,operator__ValueType}
Name | Thrown on |
---|---|
type_error.302 |
in case passed type ValueType is incompatible to the JSON value type (e.g., the JSON value is of type boolean, but a string is requested); see example below |
Name | Description |
---|---|
ValueType | non-pointer type compatible to the JSON value, for instance int for JSON integer numbers, bool for JSON booleans, or std::vector types for JSON arrays. The character type of string_t as well as an initializer list of this type is excluded to avoid ambiguities as these types implicitly convert to std::string . |
Conversion to value_t
value_t
comparison: equal
<nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
bool
operator==(ScalarType rhs) const noexcept;
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
Equality operator
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
Inequality operator
true
if the objects are not equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
comparison: 3-way
<nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
std::partial_ordering
operator<=>(ScalarType rhs) const noexcept;
Name | Description |
---|---|
rhs | The right operand |
Three-way comparison operator
<nlohmann/json.hpp>
std::partial_ordering
operator<=>(const_reference rhs) const noexcept;
Name | Description |
---|---|
rhs | The right operand |
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
bool
accept(
detail::span_input_adapter&& i,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
check if the input is valid JSON
<nlohmann/json.hpp>
template<typename InputType>
static
bool
accept(
InputType&& i,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
check if the input is valid JSON
<nlohmann/json.hpp>
template<typename IteratorType>
static
bool
accept(
IteratorType first,
IteratorType last,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
array(initializer_list_t init = {});
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type const& init);
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type&& init);
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type const& init,
binary_t::subtype_type subtype);
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type&& init,
binary_t::subtype_type subtype);
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
diff(
basic_json const& source,
basic_json const& target,
string_t const& path = "");
create a JSON value from an input in BJData format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_bjdata(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in BJData format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_bjdata(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_bson(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in BSON format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_bson(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in BSON format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_bson(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_bson(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_cbor(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
create a JSON value from an input in CBOR format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_cbor(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
Name | Description |
---|---|
tag_handler | how to treat CBOR tags |
create a JSON value from an input in CBOR format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_cbor(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
Name | Description |
---|---|
tag_handler | how to treat CBOR tags |
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_cbor(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_msgpack(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in MessagePack format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_msgpack(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in MessagePack format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_msgpack(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_msgpack(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_ubjson(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in UBJSON format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_ubjson(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in UBJSON format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_ubjson(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_ubjson(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<const_iterator>
iterator_wrapper(const_reference ref) noexcept;
<nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<iterator>
iterator_wrapper(reference ref) noexcept;
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
object(initializer_list_t init = {});
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
parse(
detail::span_input_adapter&& i,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
deserialize from a compatible input
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
parse(
InputType&& i,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
Name | Description |
---|---|
cb | per-element parser callback type |
deserialize from a pair of character iterators
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
parse(
IteratorType first,
IteratorType last,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
Name | Description |
---|---|
cb | per-element parser callback type |
generate SAX events
<nlohmann/json.hpp>
template<typename SAX>
[[__deprecated__, __nonnull__]]
static
bool
sax_parse(
detail::span_input_adapter&& i,
SAX* sax,
input_format_t format = input_format_t::json,
bool const strict = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
generate SAX events
<nlohmann/json.hpp>
template<
typename InputType,
typename SAX>
[[__nonnull__]]
static
bool
sax_parse(
InputType&& i,
SAX* sax,
input_format_t format = input_format_t::json,
bool const strict = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
generate SAX events
<nlohmann/json.hpp>
template<
class IteratorType,
class SAX>
[[__nonnull__]]
static
bool
sax_parse(
IteratorType first,
IteratorType last,
SAX* sax,
input_format_t format = input_format_t::json,
bool const strict = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
<nlohmann/json.hpp>
static
std::vector<uint8_t>
to_bjdata(
basic_json const& j,
bool const use_size = false,
bool const use_type = false,
bjdata_version_t const version = bjdata_version_t::draft2);
<nlohmann/json.hpp>
static
void
to_bjdata(
basic_json const& j,
detail::output_adapter<uint8_t> o,
bool const use_size = false,
bool const use_type = false,
bjdata_version_t const version = bjdata_version_t::draft2);
<nlohmann/json.hpp>
static
void
to_bjdata(
basic_json const& j,
detail::output_adapter<char> o,
bool const use_size = false,
bool const use_type = false,
bjdata_version_t const version = bjdata_version_t::draft2);
<nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<uint8_t> o);
<nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<char> o);
<nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<uint8_t> o);
<nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<char> o);
<nlohmann/json.hpp>
static
std::vector<uint8_t>
to_msgpack(basic_json const& j);
<nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<uint8_t> o);
<nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<char> o);
<nlohmann/json.hpp>
static
std::vector<uint8_t>
to_ubjson(
basic_json const& j,
bool const use_size = false,
bool const use_type = false);
<nlohmann/json.hpp>
static
void
to_ubjson(
basic_json const& j,
detail::output_adapter<uint8_t> o,
bool const use_size = false,
bool const use_type = false);
<nlohmann/json.hpp>
static
void
to_ubjson(
basic_json const& j,
detail::output_adapter<char> o,
bool const use_size = false,
bool const use_type = false);
a class to store JSON values
<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>
Name | Description |
---|---|
nlohmann::detail::json_base_class<CustomBaseClass> |
Name | Description |
---|---|
allocator_type | the allocator type |
array_t | a type for an array |
binary_t | a type for a packed binary type |
bjdata_version_t | how to encode BJData |
boolean_t | a type for a boolean |
cbor_tag_handler_t | how to treat CBOR tags |
const_iterator | a const iterator for a basic_json container |
const_pointer | the type of an element const pointer |
const_reference | the type of an element const reference |
const_reverse_iterator | a const reverse iterator for a basic_json container |
default_object_comparator_t | |
difference_type | a type to represent differences between iterators |
error_handler_t | how to treat decoding errors |
exception | Classes to implement user-defined exceptions. @{ |
initializer_list_t | helper type for initializer lists of basic_json values |
input_format_t | |
invalid_iterator | |
iterator | an iterator for a basic_json container |
json_pointer | JSON Pointer, see nlohmann::json_pointer |
json_sax_t | SAX interface type, see nlohmann::json_sax |
json_serializer | |
number_float_t | a type for a number (floating-point) |
number_integer_t | a type for a number (integer) |
number_unsigned_t | a type for a number (unsigned) |
object_comparator_t | object key comparator type |
object_t | a type for an object |
other_error | |
out_of_range | |
parse_error | |
parse_event_t | parser event types |
parser_callback_t | per-element parser callback type |
pointer | the type of an element pointer |
reference | the type of an element reference |
reverse_iterator | a reverse iterator for a basic_json container |
size_type | a type to represent container sizes |
string_t | a type for a string |
type_error | |
value_t | |
value_type | the type of elements in a basic_json container |
Name | Description |
---|---|
basic_json [constructor] | copy constructor |
basic_json [constructor] | move constructor |
basic_json [constructor] | create a null object |
basic_json [constructor] | create an empty value with a given type |
basic_json [constructor] | create a JSON value from an existing one |
basic_json [constructor] | //////////////////////////////////// |
basic_json [constructor] | create a JSON value from compatible types |
basic_json [constructor] | construct an array with count copies of given value |
basic_json [constructor] | construct a JSON container given an iterator range |
basic_json [constructor] | create a container (array or object) from an initializer list |
~basic_json [destructor] | destructor |
operator= | copy assignment |
at | access specified array element with bounds checking |
at | access specified array element with bounds checking |
at | access specified element via JSON Pointer |
at | access specified element via JSON Pointer |
at | access specified object element with bounds checking |
at | access specified object element with bounds checking |
at | |
at | |
at | access specified object element with bounds checking |
at | access specified object element with bounds checking |
back | access the last element |
back | access the last element |
begin | returns an iterator to the first element |
begin | returns an iterator to the first element |
cbegin | returns a const iterator to the first element |
cend | returns an iterator to one past the last element |
clear | clears the contents |
contains | check the existence of an element in a JSON object given a JSON pointer |
contains | check the existence of an element in a JSON object |
contains | |
contains | check the existence of an element in a JSON object |
count | returns the number of occurrences of a key in a JSON object |
count | returns the number of occurrences of a key in a JSON object |
crbegin | returns a const reverse iterator to the last element |
crend | returns a const reverse iterator to one before the first |
dump | serialization |
emplace | add an object to an object if key does not exist |
emplace_back | add an object to an array |
empty | checks whether the container is empty. |
end | returns an iterator to one past the last element |
end | returns an iterator to one past the last element |
erase | remove element from a JSON array given an index |
erase | remove element from a JSON object given a key |
erase | remove element given an iterator |
erase | remove element from a JSON object given a key |
erase | remove elements given an iterator range |
find | find an element in a JSON object |
find | find an element in a JSON object |
find | find an element in a JSON object |
find | find an element in a JSON object |
flatten | return flattened JSON value |
front | access the first element |
front | access the first element |
get | get a pointer value (explicit) |
get | get a (pointer) value (explicit) |
get_binary | get a binary value |
get_binary | get a binary value |
get_ptr | get a pointer value (implicit) |
get_ptr | get a pointer value (implicit) |
get_ref | get a reference value (implicit) |
get_ref | get a reference value (implicit) |
get_to | get a value (explicit) |
get_to | |
get_to | |
insert | inserts range of elements into object |
insert | inserts elements from initializer list into array |
insert | inserts element into array |
insert | inserts element into array |
insert | inserts range of elements into array |
insert | inserts copies of element into array |
insert_iterator | Helper for insertion of an iterator |
is_array | return whether value is an array |
is_binary | return whether value is a binary array |
is_boolean | return whether value is a boolean |
is_discarded | return whether value is discarded |
is_null | return whether value is null |
is_number | return whether value is a number |
is_number_float | return whether value is a floating-point number |
is_number_integer | return whether value is an integer number |
is_number_unsigned | return whether value is an unsigned integer number |
is_object | return whether value is an object |
is_primitive | return whether type is primitive |
is_string | return whether value is a string |
is_structured | return whether type is structured |
items | helper to access iterator member functions in range-based for |
items | helper to access iterator member functions in range-based for |
max_size | returns the maximum possible number of elements |
merge_patch | applies a JSON Merge Patch |
operator+= | add an object to an object |
operator+= | add an object to an array |
operator+= | add an object to an object |
operator+= | add an object to an array |
operator[] | access specified object element |
operator[] | access specified array element |
operator[] | access specified array element |
operator[] | access specified element via JSON Pointer |
operator[] | access specified element via JSON Pointer |
operator[] | access specified object element |
operator[] | Subscript operator |
operator[] | Subscript operator |
operator[] | access specified object element |
operator[] | access specified object element |
operator[] | Subscript operator |
operator[] | Subscript operator |
patch | applies a JSON patch to a copy of the current object |
patch_inplace | applies a JSON patch in-place without copying the object |
push_back | add an object to an object |
push_back | add an object to an array |
push_back | add an object to an object |
push_back | add an object to an array |
rbegin | returns an iterator to the reverse-beginning |
rbegin | returns an iterator to the reverse-beginning |
rend | returns an iterator to the reverse-end |
rend | returns an iterator to the reverse-end |
size | returns the number of elements |
swap | exchanges the values |
swap | exchanges the values |
swap | exchanges the values |
swap | exchanges the values |
swap | exchanges the values |
swap | exchanges the values |
type | return the type of the JSON value (explicit) |
type_name | return the type as string |
unflatten | unflatten a previously flattened JSON value |
update | updates a JSON object from another object, overwriting existing keys |
update | updates a JSON object from another object, overwriting existing keys |
value | access specified object element via JSON Pointer with default value |
value | access specified object element with default value |
value | access specified object element via JSON Pointer with default value |
value | access specified object element with default value |
value | |
value | access specified object element with default value |
value | |
value | access specified object element via JSON Pointer with default value |
operator ValueType | get a value (implicit) |
operator value_t | return the type of the JSON value (implicit) |
operator== | comparison: equal |
operator== | comparison: equal |
operator!= | comparison: not equal |
operator<=> | comparison: 3-way |
operator<=> | comparison: 3-way |
Name | Description |
---|---|
accept | |
accept | check if the input is valid JSON |
accept | check if the input is valid JSON |
array | explicitly create an array from an initializer list |
binary | explicitly create a binary array (without subtype) |
binary | explicitly create a binary array |
binary | explicitly create a binary array (with subtype) |
binary | explicitly create a binary array (with subtype) |
diff | creates a diff as a JSON patch |
from_bjdata | create a JSON value from an input in BJData format |
from_bjdata | create a JSON value from an input in BJData format |
from_bson | |
from_bson | create a JSON value from an input in BSON format |
from_bson | create a JSON value from an input in BSON format |
from_bson | |
from_cbor | |
from_cbor | create a JSON value from an input in CBOR format |
from_cbor | create a JSON value from an input in CBOR format |
from_cbor | |
from_msgpack | |
from_msgpack | create a JSON value from an input in MessagePack format |
from_msgpack | create a JSON value from an input in MessagePack format |
from_msgpack | |
from_ubjson | |
from_ubjson | create a JSON value from an input in UBJSON format |
from_ubjson | create a JSON value from an input in UBJSON format |
from_ubjson | |
get_allocator | returns the allocator associated with the container |
iterator_wrapper | wrapper to access iterator member functions in range-based for |
iterator_wrapper | wrapper to access iterator member functions in range-based for |
meta | returns version information on the library |
object | explicitly create an object from an initializer list |
parse | |
parse | deserialize from a compatible input |
parse | deserialize from a pair of character iterators |
sax_parse | generate SAX events |
sax_parse | generate SAX events |
sax_parse | generate SAX events |
to_bjdata | create a BJData serialization of a given JSON value |
to_bjdata | create a BJData serialization of a given JSON value |
to_bjdata | create a BJData serialization of a given JSON value |
to_bson | create a BSON serialization of a given JSON value |
to_bson | create a BSON serialization of a given JSON value |
to_bson | create a BSON serialization of a given JSON value |
to_cbor | create a CBOR serialization of a given JSON value |
to_cbor | create a CBOR serialization of a given JSON value |
to_cbor | create a CBOR serialization of a given JSON value |
to_msgpack | create a MessagePack serialization of a given JSON value |
to_msgpack | create a MessagePack serialization of a given JSON value |
to_msgpack | create a MessagePack serialization of a given JSON value |
to_ubjson | create a UBJSON serialization of a given JSON value |
to_ubjson | create a UBJSON serialization of a given JSON value |
to_ubjson | create a UBJSON serialization of a given JSON value |
Name | Description |
---|---|
operator>> |
deserialize from stream |
operator<< |
deserialize from stream |
operator>> |
serialize to stream |
operator<< |
serialize to stream |
swap |
exchanges the values |
exception |
general exception of the basic_json class |
serializer |
|
json_pointer |
Name | Description |
---|---|
operator<< | deserialize from stream |
operator>> | serialize to stream |
to_string | user-defined to_string function for JSON values |
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/9860911
the allocator type
<nlohmann/json.hpp>
using allocator_type = AllocatorType<basic_json>;
a type for an array
<nlohmann/json.hpp>
using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
a type for a packed binary type
<nlohmann/json.hpp>
using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;
how to encode BJData
<nlohmann/json.hpp>
using bjdata_version_t = detail::bjdata_version_t;
a type for a boolean
<nlohmann/json.hpp>
using boolean_t = BooleanType;
how to treat CBOR tags
<nlohmann/json.hpp>
using cbor_tag_handler_t = detail::cbor_tag_handler_t;
a const iterator for a basic_json container
the type of an element const pointer
<nlohmann/json.hpp>
using const_pointer = std::allocator_traits<allocator_type>::const_pointer;
the type of an element const reference
a const reverse iterator for a basic_json container
<nlohmann/json.hpp>
using const_reverse_iterator = json_reverse_iterator<basic_json::const_iterator>;
<nlohmann/json.hpp>
using default_object_comparator_t = std::less;
a type to represent differences between iterators
<nlohmann/json.hpp>
using difference_type = std::ptrdiff_t;
how to treat decoding errors
<nlohmann/json.hpp>
using error_handler_t = detail::error_handler_t;
Classes to implement user-defined exceptions. @{
<nlohmann/json.hpp>
using exception = detail::exception;
helper type for initializer lists of basic_json values
<nlohmann/json.hpp>
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
<nlohmann/json.hpp>
using input_format_t = detail::input_format_t;
<nlohmann/json.hpp>
using invalid_iterator = detail::invalid_iterator;
an iterator for a basic_json container
JSON Pointer, see nlohmann::json_pointer
SAX interface type, see nlohmann::json_sax
<nlohmann/json.hpp>
using json_sax_t = json_sax<basic_json>;
<nlohmann/json.hpp>
template<
typename T,
typename SFINAE>
using json_serializer = JSONSerializer<T, SFINAE>;
a type for a number (floating-point)
<nlohmann/json.hpp>
using number_float_t = NumberFloatType;
a type for a number (integer)
<nlohmann/json.hpp>
using number_integer_t = NumberIntegerType;
a type for a number (unsigned)
<nlohmann/json.hpp>
using number_unsigned_t = NumberUnsignedType;
object key comparator type
<nlohmann/json.hpp>
using object_comparator_t = detail::actual_object_comparator_t<basic_json>;
a type for an object
<nlohmann/json.hpp>
using object_t = ObjectType<StringType, basic_json, default_object_comparator_t, AllocatorType<std::pair<StringType const, basic_json>>>;
<nlohmann/json.hpp>
using other_error = detail::other_error;
<nlohmann/json.hpp>
using out_of_range = detail::out_of_range;
<nlohmann/json.hpp>
using parse_error = detail::parse_error;
parser event types
<nlohmann/json.hpp>
using parse_event_t = detail::parse_event_t;
per-element parser callback type
<nlohmann/json.hpp>
using parser_callback_t = detail::parser_callback_t<basic_json>;
the type of an element pointer
<nlohmann/json.hpp>
using pointer = std::allocator_traits<allocator_type>::pointer;
the type of an element reference
a reverse iterator for a basic_json container
<nlohmann/json.hpp>
using reverse_iterator = json_reverse_iterator<basic_json::iterator>;
a type to represent container sizes
<nlohmann/json.hpp>
using size_type = std::size_t;
a type for a string
<nlohmann/json.hpp>
using string_t = StringType;
<nlohmann/json.hpp>
using type_error = detail::type_error;
<nlohmann/json.hpp>
using value_t = detail::value_t;
the type of elements in a basic_json container
copy constructor
Name | Description |
---|---|
other | The object to copy construct from |
move constructor
Name | Description |
---|---|
other | The object to move construct from |
create a null object
<nlohmann/json.hpp>
basic_json(std::nullptr_t value = nullptr) noexcept;
Name | Description |
---|---|
value | The object to construct from |
create an empty value with a given type
Name | Description |
---|---|
v | The object to construct from |
create a JSON value from an existing one
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value&& !std::is_same<basic_json, BasicJsonType>::value
basic_json(BasicJsonType const& val);
Name | Description |
---|---|
val | The object to copy construct from |
////////////////////////////////////
<nlohmann/json.hpp>
template<typename JsonRef>
requires detail::conjunction<detail::is_json_ref<JsonRef>,
std::is_same<typename JsonRef::value_type, basic_json>>::value
basic_json(JsonRef const& ref);
Name | Description |
---|---|
ref | The object to copy construct from |
create a JSON value from compatible types
<nlohmann/json.hpp>
template<
typename CompatibleType,
typename U = detail::uncvref_t<CompatibleType>>
requires !detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value
basic_json(CompatibleType&& val) noexcept(noexcept(JSONSerializer<U, void>::to_json(std::declval<basic_json_t &>(), std::forward<CompatibleType>(val))));
Name | Description |
---|---|
val | The object to move construct from |
construct an array with count copies of given value
Name | Description |
---|---|
cnt | The object to construct from |
val | a class to store JSON values |
construct a JSON container given an iterator range
<nlohmann/json.hpp>
template<class InputIT>
requires std::is_same<InputIT, typename basic_json_t::iterator>::value ||
std::is_same<InputIT, typename basic_json_t::const_iterator>::value
basic_json(
InputIT first,
InputIT last);
Name | Description |
---|---|
first | The object to construct from |
create a container (array or object) from an initializer list
<nlohmann/json.hpp>
basic_json(
initializer_list_t init,
bool type_deduction = true,
value_t manual_type = value_t::array);
Name | Description |
---|---|
init | The object to construct from |
destructor
<nlohmann/json.hpp>
~basic_json() noexcept;
copy assignment
<nlohmann/json.hpp>
basic_json&
operator=(basic_json other) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value && std::is_nothrow_move_assignable<json_base_class_t>::value);
Name | Description |
---|---|
other | The object to assign from |
access specified array element with bounds checking
Name | Description |
---|---|
idx | a type to represent container sizes |
access specified array element with bounds checking
Name | Description |
---|---|
idx | a type to represent container sizes |
access specified element via JSON Pointer
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
access specified element via JSON Pointer
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
access specified object element with bounds checking
access specified object element with bounds checking
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
at(nlohmann::json_pointer<BasicJsonType> const& ptr);
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
const_reference
at(nlohmann::json_pointer<BasicJsonType> const& ptr) const;
access specified object element with bounds checking
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
at(KeyType&& key);
access specified object element with bounds checking
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
const_reference
at(KeyType&& key) const;
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
<nlohmann/json.hpp>
void
clear() noexcept;
check the existence of an element in a JSON object given a JSON pointer
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
check the existence of an element in a JSON object
<nlohmann/json.hpp>
bool
contains(object_t::key_type const& key) const;
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
bool
contains(nlohmann::json_pointer<BasicJsonType> const& ptr) const;
check the existence of an element in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
bool
contains(KeyType&& key) const;
returns the number of occurrences of a key in a JSON object
returns the number of occurrences of a key in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
size_type
count(KeyType&& key) const;
returns a const reverse iterator to the last element
returns a const reverse iterator to one before the first
serialization
<nlohmann/json.hpp>
string_t
dump(
int const indent = -1,
char const indent_char = ' ',
bool const ensure_ascii = false,
error_handler_t const error_handler = error_handler_t::strict) const;
Name | Description |
---|---|
error_handler | how to treat decoding errors |
add an object to an object if key does not exist
<nlohmann/json.hpp>
template<class... Args>
std::pair<iterator, bool>
emplace(Args...&&... args);
add an object to an array
<nlohmann/json.hpp>
template<class... Args>
reference
emplace_back(Args...&&... args);
checks whether the container is empty.
<nlohmann/json.hpp>
bool
empty() const noexcept;
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
Name | Description |
---|---|
idx | a type to represent container sizes |
remove element from a JSON object given a key
remove element given an iterator
<nlohmann/json.hpp>
template<class IteratorType>
requires std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
std::is_same<IteratorType, typename basic_json_t::const_iterator>::value
IteratorType
erase(IteratorType pos);
remove element from a JSON object given a key
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
size_type
erase(KeyType&& key);
remove elements given an iterator range
<nlohmann/json.hpp>
template<class IteratorType>
requires std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
std::is_same<IteratorType, typename basic_json_t::const_iterator>::value
IteratorType
erase(
IteratorType first,
IteratorType last);
find an element in a JSON object
find an element in a JSON object
find an element in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
iterator
find(KeyType&& key);
find an element in a JSON object
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
const_iterator
find(KeyType&& key) const;
return flattened JSON value
access the first element
access the first element
get a pointer value (explicit)
<nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
get() noexcept;
Explicit pointer access to the internally stored JSON value. No copies are made.
The pointer becomes invalid if the underlying JSON object changes.
Constant.
{The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr
is returned if the value and the requested pointer type does not match.,get__PointerType}
nullptr
otherwise
Name | Description |
---|---|
PointerType | pointer type; must be a pointer to array_t , object_t , string_t , boolean_t , number_integer_t , number_unsigned_t , or number_float_t . |
get a (pointer) value (explicit)
<nlohmann/json.hpp>
template<
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>>
constexpr
decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
get() const noexcept(noexcept(std::declval<const basic_json_t &>().template get_impl<ValueType>(detail::priority_tag<4>{})));
Performs explicit type conversion between the JSON value and a compatible value if required.
- If the requested type is a pointer to the internally stored JSON value that pointer is returned. No copies are made.
- If the requested type is the current basic_json
, or a different basic_json
convertible from the current basic_json
.
- Otherwise the value is converted by calling the json_serializer<ValueType>
from_json()
method.
Name | Thrown on |
---|---|
what |
json_serializer<ValueType> from_json() method throws if conversion is required |
Name | Description |
---|---|
ValueTypeCV | the provided value type |
ValueType | the returned value type |
ValueType | if necessary |
get a binary value
get a binary value
get a pointer value (implicit)
<nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
get_ptr() noexcept;
get a pointer value (implicit)
<nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value&&
std::is_const<typename std::remove_pointer<PointerType>::type>::value
constexpr
decltype(std::declval<const basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
get_ptr() const noexcept;
get a reference value (implicit)
<nlohmann/json.hpp>
template<typename ReferenceType>
requires std::is_reference<ReferenceType>::value
ReferenceType
get_ref();
get a reference value (implicit)
<nlohmann/json.hpp>
template<typename ReferenceType>
requires std::is_reference<ReferenceType>::value&&
std::is_const<typename std::remove_reference<ReferenceType>::type>::value
ReferenceType
get_ref() const;
get a value (explicit)
<nlohmann/json.hpp>
template<typename ValueType>
requires !detail::is_basic_json<ValueType>::value&&
detail::has_from_json<basic_json_t, ValueType>::value
ValueType&
get_to(ValueType& v) const noexcept(noexcept(JSONSerializer<ValueType, void>::from_json(std::declval<const basic_json_t &>(), v)));
<nlohmann/json.hpp>
template<typename ValueType>
requires detail::is_basic_json<ValueType>::value
ValueType&
get_to(ValueType& v) const;
<nlohmann/json.hpp>
template<
typename T,
std::size_t N,
typename Array = T(&)[]>
requires detail::has_from_json<basic_json_t, Array>::value
Array
get_to(T(& v)[]) const noexcept(noexcept(JSONSerializer<Array, void>::from_json(std::declval<const basic_json_t &>(), v)));
inserts range of elements into object
Name | Description |
---|---|
first | a const iterator for a basic_json container |
last | a const iterator for a basic_json container |
inserts elements from initializer list into array
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
initializer_list_t ilist);
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
ilist | helper type for initializer lists of basic_json values |
inserts element into array
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
basic_json const& val);
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
val | a class to store JSON values |
inserts element into array
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
val | a class to store JSON values |
inserts range of elements into array
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
const_iterator first,
const_iterator last);
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
first | a const iterator for a basic_json container |
last | a const iterator for a basic_json container |
inserts copies of element into array
<nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
size_type cnt,
basic_json const& val);
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
cnt | a type to represent container sizes |
val | a class to store JSON values |
Helper for insertion of an iterator
<nlohmann/json.hpp>
template<typename... Args>
iterator
insert_iterator(
const_iterator pos,
Args...&&... args);
: This uses std::distance to support GCC 4.8, see https://github.com/nlohmann/json/pull/1257
Name | Description |
---|---|
pos | a const iterator for a basic_json container |
return whether value is an array
<nlohmann/json.hpp>
constexpr
bool
is_array() const noexcept;
return whether value is a binary array
<nlohmann/json.hpp>
constexpr
bool
is_binary() const noexcept;
return whether value is a boolean
<nlohmann/json.hpp>
constexpr
bool
is_boolean() const noexcept;
return whether value is discarded
<nlohmann/json.hpp>
constexpr
bool
is_discarded() const noexcept;
return whether value is null
<nlohmann/json.hpp>
constexpr
bool
is_null() const noexcept;
return whether value is a number
<nlohmann/json.hpp>
constexpr
bool
is_number() const noexcept;
return whether value is a floating-point number
<nlohmann/json.hpp>
constexpr
bool
is_number_float() const noexcept;
return whether value is an integer number
<nlohmann/json.hpp>
constexpr
bool
is_number_integer() const noexcept;
return whether value is an unsigned integer number
<nlohmann/json.hpp>
constexpr
bool
is_number_unsigned() const noexcept;
return whether value is an object
<nlohmann/json.hpp>
constexpr
bool
is_object() const noexcept;
return whether type is primitive
<nlohmann/json.hpp>
constexpr
bool
is_primitive() const noexcept;
return whether value is a string
<nlohmann/json.hpp>
constexpr
bool
is_string() const noexcept;
return whether type is structured
<nlohmann/json.hpp>
constexpr
bool
is_structured() const noexcept;
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
Name | Description |
---|---|
apply_patch | a class to store JSON values |
add an object to an object
Name | Description |
---|---|
init | The right operand |
add an object to an array
Name | Description |
---|---|
val | The right operand |
add an object to an object
Name | Description |
---|---|
val | The right operand |
add an object to an array
Name | Description |
---|---|
val | The right operand |
access specified object element
Name | Description |
---|---|
key | The right operand |
access specified array element
Name | Description |
---|---|
idx | The right operand |
access specified array element
Name | Description |
---|---|
idx | The right operand |
access specified element via JSON Pointer
Name | Description |
---|---|
ptr | The right operand |
access specified element via JSON Pointer
Name | Description |
---|---|
ptr | The right operand |
access specified object element
<nlohmann/json.hpp>
const_reference
operator[](object_t::key_type const& key) const;
Name | Description |
---|---|
key | The right operand |
Subscript operator
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr);
Name | Description |
---|---|
ptr | The right operand |
Subscript operator
<nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
const_reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr) const;
Name | Description |
---|---|
ptr | The right operand |
access specified object element
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
operator[](KeyType&& key);
Name | Description |
---|---|
key | The right operand |
access specified object element
<nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
const_reference
operator[](KeyType&& key) const;
Name | Description |
---|---|
key | The right operand |
Subscript operator
Name | Description |
---|---|
key | The right operand |
Subscript operator
<nlohmann/json.hpp>
template<typename T>
const_reference
operator[](T* key) const;
Name | Description |
---|---|
key | The right operand |
applies a JSON patch to a copy of the current object
Name | Description |
---|---|
json_patch | a class to store JSON values |
applies a JSON patch in-place without copying the object
Name | Description |
---|---|
json_patch | a class to store JSON values |
add an object to an object
Name | Description |
---|---|
init | helper type for initializer lists of basic_json values |
add an object to an array
Name | Description |
---|---|
val | a class to store JSON values |
add an object to an object
<nlohmann/json.hpp>
void
push_back(object_t::value_type const& val);
add an object to an array
Name | Description |
---|---|
val | a class to store JSON values |
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
<nlohmann/json.hpp>
void
swap(reference other) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value);
Name | Description |
---|---|
other | the type of an element reference |
exchanges the values
Name | Description |
---|---|
other | a type for an array |
exchanges the values
Name | Description |
---|---|
other | a type for a packed binary type |
exchanges the values
<nlohmann/json.hpp>
void
swap(binary_t::container_type& other);
exchanges the values
Name | Description |
---|---|
other | a type for an object |
exchanges the values
Name | Description |
---|---|
other | a type for a string |
return the type of the JSON value (explicit)
return the type as string
<nlohmann/json.hpp>
[[__returns_nonnull__]]
char const*
type_name() const noexcept;
unflatten a previously flattened JSON value
updates a JSON object from another object, overwriting existing keys
<nlohmann/json.hpp>
void
update(
const_reference j,
bool merge_objects = false);
Name | Description |
---|---|
j | the type of an element const reference |
updates a JSON object from another object, overwriting existing keys
<nlohmann/json.hpp>
void
update(
const_iterator first,
const_iterator last,
bool merge_objects = false);
Name | Description |
---|---|
first | a const iterator for a basic_json container |
last | a const iterator for a basic_json container |
access specified object element via JSON Pointer with default value
<nlohmann/json.hpp>
template<class ValueType>
requires detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
json_pointer const& ptr,
ValueType const& default_value) const;
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
access specified object element with default value
<nlohmann/json.hpp>
template<class ValueType>
requires !detail::is_transparent<object_comparator_t>::value
&& detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
object_t::key_type const& key,
ValueType const& default_value) const;
access specified object element via JSON Pointer with default value
<nlohmann/json.hpp>
template<
class ValueType,
class ReturnType = value_return_type<ValueType>::type>
requires detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ReturnType
value(
json_pointer const& ptr,
ValueType&& default_value) const;
Name | Description |
---|---|
ptr | JSON Pointer, see nlohmann::json_pointer |
access specified object element with default value
<nlohmann/json.hpp>
template<
class ValueType,
class ReturnType = value_return_type<ValueType>::type>
requires !detail::is_transparent<object_comparator_t>::value
&& detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ReturnType
value(
object_t::key_type const& key,
ValueType&& default_value) const;
<nlohmann/json.hpp>
template<
class ValueType,
class BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
&& detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
[[__deprecated__]]
ValueType
value(
nlohmann::json_pointer<BasicJsonType> const& ptr,
ValueType const& default_value) const;
access specified object element with default value
<nlohmann/json.hpp>
template<
class ValueType,
class KeyType>
requires detail::is_transparent<object_comparator_t>::value
&& !detail::is_json_pointer<KeyType>::value
&& is_comparable_with_object_key<KeyType>::value
&& detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ValueType
value(
KeyType&& key,
ValueType const& default_value) const;
<nlohmann/json.hpp>
template<
class ValueType,
class BasicJsonType,
class ReturnType = value_return_type<ValueType>::type>
requires detail::is_basic_json<BasicJsonType>::value
&& detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
[[__deprecated__]]
ReturnType
value(
nlohmann::json_pointer<BasicJsonType> const& ptr,
ValueType&& default_value) const;
access specified object element via JSON Pointer with default value
<nlohmann/json.hpp>
template<
class ValueType,
class KeyType,
class ReturnType = value_return_type<ValueType>::type>
requires detail::is_transparent<object_comparator_t>::value
&& !detail::is_json_pointer<KeyType>::value
&& is_comparable_with_object_key<KeyType>::value
&& detail::is_getable<basic_json_t, ReturnType>::value
&& !std::is_same<value_t, detail::uncvref_t<ValueType>>::value
ReturnType
value(
KeyType&& key,
ValueType&& default_value) const;
get a value (implicit)
<nlohmann/json.hpp>
template<typename ValueType>
requires detail::conjunction <
detail::negation<std::is_pointer<ValueType>>,
detail::negation<std::is_same<ValueType, std::nullptr_t>>,
detail::negation<std::is_same<ValueType, detail::json_ref<basic_json>>>,
detail::negation<std::is_same<ValueType, typename string_t::value_type>>,
detail::negation<detail::is_basic_json<ValueType>>,
detail::negation<std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>>,
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
detail::negation<std::is_same<ValueType, std::string_view>>,
#endif
#if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI
detail::negation<std::is_same<ValueType, std::any>>,
#endif
detail::is_detected_lazy<detail::get_template_function, const basic_json_t&, ValueType>
>::value
operator ValueType() const;
Implicit type conversion between the JSON value and a compatible value. The call is realized by calling get() const
.
Linear in the size of the JSON value.
{The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard std::vector<short>
, (3) A JSON object can be converted to C++ associative containers such as std::unordered_map<std::string\, json>
.,operator__ValueType}
Name | Thrown on |
---|---|
type_error.302 |
in case passed type ValueType is incompatible to the JSON value type (e.g., the JSON value is of type boolean, but a string is requested); see example below |
Name | Description |
---|---|
ValueType | non-pointer type compatible to the JSON value, for instance int for JSON integer numbers, bool for JSON booleans, or std::vector types for JSON arrays. The character type of string_t as well as an initializer list of this type is excluded to avoid ambiguities as these types implicitly convert to std::string . |
return the type of the JSON value (implicit)
value_t
comparison: equal
<nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
bool
operator==(ScalarType rhs) const noexcept;
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
comparison: equal
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
comparison: not equal
true
if the objects are not equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
comparison: 3-way
<nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
std::partial_ordering
operator<=>(ScalarType rhs) const noexcept;
Name | Description |
---|---|
rhs | The right operand |
comparison: 3-way
<nlohmann/json.hpp>
std::partial_ordering
operator<=>(const_reference rhs) const noexcept;
Name | Description |
---|---|
rhs | The right operand |
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
bool
accept(
detail::span_input_adapter&& i,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
check if the input is valid JSON
<nlohmann/json.hpp>
template<typename InputType>
static
bool
accept(
InputType&& i,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
check if the input is valid JSON
<nlohmann/json.hpp>
template<typename IteratorType>
static
bool
accept(
IteratorType first,
IteratorType last,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
explicitly create an array from an initializer list
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
array(initializer_list_t init = {});
Name | Description |
---|---|
init | helper type for initializer lists of basic_json values |
explicitly create a binary array (without subtype)
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type const& init);
explicitly create a binary array
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type&& init);
explicitly create a binary array (with subtype)
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type const& init,
binary_t::subtype_type subtype);
explicitly create a binary array (with subtype)
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type&& init,
binary_t::subtype_type subtype);
creates a diff as a JSON patch
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
diff(
basic_json const& source,
basic_json const& target,
string_t const& path = "");
Name | Description |
---|---|
source | a class to store JSON values |
target | a class to store JSON values |
path | a type for a string |
create a JSON value from an input in BJData format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_bjdata(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in BJData format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_bjdata(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_bson(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in BSON format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_bson(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in BSON format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_bson(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_bson(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_cbor(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
create a JSON value from an input in CBOR format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_cbor(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
Name | Description |
---|---|
tag_handler | how to treat CBOR tags |
create a JSON value from an input in CBOR format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_cbor(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
Name | Description |
---|---|
tag_handler | how to treat CBOR tags |
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_cbor(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true,
cbor_tag_handler_t const tag_handler = cbor_tag_handler_t::error);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_msgpack(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in MessagePack format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_msgpack(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in MessagePack format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_msgpack(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_msgpack(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_ubjson(
detail::span_input_adapter&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in UBJSON format
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
from_ubjson(
InputType&& i,
bool const strict = true,
bool const allow_exceptions = true);
create a JSON value from an input in UBJSON format
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
from_ubjson(
IteratorType first,
IteratorType last,
bool const strict = true,
bool const allow_exceptions = true);
<nlohmann/json.hpp>
template<typename T>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
from_ubjson(
T const* ptr,
std::size_t len,
bool const strict = true,
bool const allow_exceptions = true);
returns the allocator associated with the container
wrapper to access iterator member functions in range-based for
<nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<const_iterator>
iterator_wrapper(const_reference ref) noexcept;
Name | Description |
---|---|
ref | the type of an element const reference |
wrapper to access iterator member functions in range-based for
<nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<iterator>
iterator_wrapper(reference ref) noexcept;
Name | Description |
---|---|
ref | the type of an element reference |
returns version information on the library
explicitly create an object from an initializer list
<nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
object(initializer_list_t init = {});
Name | Description |
---|---|
init | helper type for initializer lists of basic_json values |
<nlohmann/json.hpp>
[[__warn_unused_result__, __deprecated__]]
static
basic_json
parse(
detail::span_input_adapter&& i,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
deserialize from a compatible input
<nlohmann/json.hpp>
template<typename InputType>
[[__warn_unused_result__]]
static
basic_json
parse(
InputType&& i,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
Name | Description |
---|---|
cb | per-element parser callback type |
deserialize from a pair of character iterators
<nlohmann/json.hpp>
template<typename IteratorType>
[[__warn_unused_result__]]
static
basic_json
parse(
IteratorType first,
IteratorType last,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
Name | Description |
---|---|
cb | per-element parser callback type |
generate SAX events
<nlohmann/json.hpp>
template<typename SAX>
[[__deprecated__, __nonnull__]]
static
bool
sax_parse(
detail::span_input_adapter&& i,
SAX* sax,
input_format_t format = input_format_t::json,
bool const strict = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
generate SAX events
<nlohmann/json.hpp>
template<
typename InputType,
typename SAX>
[[__nonnull__]]
static
bool
sax_parse(
InputType&& i,
SAX* sax,
input_format_t format = input_format_t::json,
bool const strict = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
generate SAX events
<nlohmann/json.hpp>
template<
class IteratorType,
class SAX>
[[__nonnull__]]
static
bool
sax_parse(
IteratorType first,
IteratorType last,
SAX* sax,
input_format_t format = input_format_t::json,
bool const strict = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
create a BJData serialization of a given JSON value
<nlohmann/json.hpp>
static
std::vector<uint8_t>
to_bjdata(
basic_json const& j,
bool const use_size = false,
bool const use_type = false,
bjdata_version_t const version = bjdata_version_t::draft2);
Name | Description |
---|---|
j | a class to store JSON values |
version | how to encode BJData |
create a BJData serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_bjdata(
basic_json const& j,
detail::output_adapter<uint8_t> o,
bool const use_size = false,
bool const use_type = false,
bjdata_version_t const version = bjdata_version_t::draft2);
Name | Description |
---|---|
j | a class to store JSON values |
version | how to encode BJData |
create a BJData serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_bjdata(
basic_json const& j,
detail::output_adapter<char> o,
bool const use_size = false,
bool const use_type = false,
bjdata_version_t const version = bjdata_version_t::draft2);
Name | Description |
---|---|
j | a class to store JSON values |
version | how to encode BJData |
create a BSON serialization of a given JSON value
Name | Description |
---|---|
j | a class to store JSON values |
create a BSON serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Name | Description |
---|---|
j | a class to store JSON values |
create a BSON serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<char> o);
Name | Description |
---|---|
j | a class to store JSON values |
create a CBOR serialization of a given JSON value
Name | Description |
---|---|
j | a class to store JSON values |
create a CBOR serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Name | Description |
---|---|
j | a class to store JSON values |
create a CBOR serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<char> o);
Name | Description |
---|---|
j | a class to store JSON values |
create a MessagePack serialization of a given JSON value
<nlohmann/json.hpp>
static
std::vector<uint8_t>
to_msgpack(basic_json const& j);
Name | Description |
---|---|
j | a class to store JSON values |
create a MessagePack serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Name | Description |
---|---|
j | a class to store JSON values |
create a MessagePack serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<char> o);
Name | Description |
---|---|
j | a class to store JSON values |
create a UBJSON serialization of a given JSON value
<nlohmann/json.hpp>
static
std::vector<uint8_t>
to_ubjson(
basic_json const& j,
bool const use_size = false,
bool const use_type = false);
Name | Description |
---|---|
j | a class to store JSON values |
create a UBJSON serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_ubjson(
basic_json const& j,
detail::output_adapter<uint8_t> o,
bool const use_size = false,
bool const use_type = false);
Name | Description |
---|---|
j | a class to store JSON values |
create a UBJSON serialization of a given JSON value
<nlohmann/json.hpp>
static
void
to_ubjson(
basic_json const& j,
detail::output_adapter<char> o,
bool const use_size = false,
bool const use_type = false);
Name | Description |
---|---|
j | a class to store JSON values |
an internal type for a backed binary type
<nlohmann/byte_container_with_subtype.hpp>
template<typename BinaryType>
class byte_container_with_subtype
: public BinaryType
Name | Description |
---|---|
BinaryType |
Name |
---|
container_type |
subtype_type |
Name | Description |
---|---|
byte_container_with_subtype [constructor] | Default constructor |
byte_container_with_subtype [constructor] | Construct from container_type |
byte_container_with_subtype [constructor] | Construct from container_type |
byte_container_with_subtype [constructor] | |
byte_container_with_subtype [constructor] | |
clear_subtype | clears the binary subtype |
has_subtype | return whether the value has a subtype |
set_subtype | sets the binary subtype |
subtype | return the binary subtype |
operator== | Equality operator |
operator!= | Inequality operator |
<nlohmann/byte_container_with_subtype.hpp>
using container_type = BinaryType;
<nlohmann/byte_container_with_subtype.hpp>
using subtype_type = uint64_t;
Default constructor
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype() noexcept(noexcept(container_type()));
Construct from container_type
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type const& b) noexcept(noexcept(container_type(b)));
Name | Description |
---|---|
b | The object to copy construct from |
Construct from container_type
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))));
Name | Description |
---|---|
b | The object to move construct from |
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type const& b,
subtype_type subtype_) noexcept(noexcept(container_type(b)));
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type&& b,
subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))));
clears the binary subtype
<nlohmann/byte_container_with_subtype.hpp>
void
clear_subtype() noexcept;
return whether the value has a subtype
<nlohmann/byte_container_with_subtype.hpp>
constexpr
bool
has_subtype() const noexcept;
sets the binary subtype
<nlohmann/byte_container_with_subtype.hpp>
void
set_subtype(subtype_type subtype_) noexcept;
return the binary subtype
<nlohmann/byte_container_with_subtype.hpp>
constexpr
subtype_type
subtype() const noexcept;
Equality operator
<nlohmann/byte_container_with_subtype.hpp>
bool
operator==(byte_container_with_subtype const& rhs) const;
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
Inequality operator
<nlohmann/byte_container_with_subtype.hpp>
bool
operator!=(byte_container_with_subtype const& rhs) const;
true
if the objects are not equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
<nlohmann/byte_container_with_subtype.hpp>
template<>
class byte_container_with_subtype<vector<unsigned char>>
: public vector<unsigned char>
Name | Description |
---|---|
vector<unsigned char> |
Name |
---|
container_type |
subtype_type |
Name | Description |
---|---|
byte_container_with_subtype [constructor] | Constructors |
clear_subtype | |
has_subtype | |
set_subtype | |
subtype | |
operator== | Equality operator |
operator!= | Inequality operator |
<nlohmann/byte_container_with_subtype.hpp>
using container_type = vector<unsigned char>;
<nlohmann/byte_container_with_subtype.hpp>
using subtype_type = uint64_t;
Constructors
<nlohmann/byte_container_with_subtype.hpp>
Default constructor
byte_container_with_subtype() noexcept(noexcept(container_type()));
» more...
Construct from container_type
byte_container_with_subtype(container_type const& b) noexcept(noexcept(container_type(b)));
» more...
Construct from container_type
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))));
» more...
byte_container_with_subtype(
container_type const& b,
subtype_type subtype_) noexcept(noexcept(container_type(b)));
» more...
byte_container_with_subtype(
container_type&& b,
subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))));
» more...
Default constructor
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype() noexcept(noexcept(container_type()));
Construct from container_type
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type const& b) noexcept(noexcept(container_type(b)));
Name | Description |
---|---|
b | The object to copy construct from |
Construct from container_type
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))));
Name | Description |
---|---|
b | The object to move construct from |
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type const& b,
subtype_type subtype_) noexcept(noexcept(container_type(b)));
<nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type&& b,
subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))));
<nlohmann/byte_container_with_subtype.hpp>
void
clear_subtype() noexcept;
<nlohmann/byte_container_with_subtype.hpp>
constexpr
bool
has_subtype() const noexcept;
<nlohmann/byte_container_with_subtype.hpp>
void
set_subtype(subtype_type subtype_) noexcept;
<nlohmann/byte_container_with_subtype.hpp>
constexpr
subtype_type
subtype() const noexcept;
Equality operator
<nlohmann/byte_container_with_subtype.hpp>
bool
operator==(byte_container_with_subtype<vector<unsigned char>> const& rhs) const;
true
if the objects are equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
Inequality operator
<nlohmann/byte_container_with_subtype.hpp>
bool
operator!=(byte_container_with_subtype<vector<unsigned char>> const& rhs) const;
true
if the objects are not equal, false
otherwise
Name | Description |
---|---|
rhs | The right operand |
<nlohmann/json.hpp>
template<typename>
class json_pointer;
JSON Pointer defines a string syntax for identifying a specific value within a JSON document
<nlohmann/json_fwd.hpp>
template<typename RefStringType>
class json_pointer;
Name | Description |
---|---|
operator/ |
create a new JSON pointer by appending the array-index-token at the end of the JSON pointer |
operator/ |
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer |
operator/ |
create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer |
operator<< |
write string representation of the JSON pointer to stream |
json_pointer |
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
basic_json |
a class to store JSON values |
a minimal map-like container that preserves insertion order
<nlohmann/ordered_map.hpp>
template<
class Key,
class T,
class IgnoredLess,
class Allocator>
struct ordered_map
: std::vector<std::pair<Key const, T>, Allocator>
Name | Description |
---|---|
std::vector<std::pair<Key const, T>, Allocator> |
Name |
---|
Container |
const_iterator |
iterator |
key_compare |
key_type |
mapped_type |
require_input_iter |
size_type |
value_type |
Name | Description |
---|---|
ordered_map [constructor] | Constructors |
at | |
count | |
emplace | |
erase | |
find | |
insert | |
operator[] | Subscript operators |
ordered_map: a minimal map-like container that preserves insertion order for use within nlohmann::basic_json<ordered_map>
<nlohmann/ordered_map.hpp>
using Container = std::vector<std::pair<Key const, T>, Allocator>;
<nlohmann/ordered_map.hpp>
using const_iterator = Container::const_iterator;
<nlohmann/ordered_map.hpp>
using iterator = Container::iterator;
<nlohmann/ordered_map.hpp>
using key_compare = std::equal_to;
<nlohmann/ordered_map.hpp>
using key_type = Key;
<nlohmann/ordered_map.hpp>
using mapped_type = T;
<nlohmann/ordered_map.hpp>
template<typename InputIt>
using require_input_iter = void;
<nlohmann/ordered_map.hpp>
using size_type = Container::size_type;
<nlohmann/ordered_map.hpp>
using value_type = Container::value_type;
Constructors
<nlohmann/ordered_map.hpp>
Default constructor
ordered_map() noexcept(noexcept(Container()));
» more...
Construct from Allocator
explicit
ordered_map(Allocator const& alloc) noexcept(noexcept(Container(alloc)));
» more...
ordered_map(
std::initializer_list<value_type> init,
Allocator const& alloc = Allocator());
» more...
template<class It>
ordered_map(
It first,
It last,
Allocator const& alloc = Allocator());
» more...
Default constructor
<nlohmann/ordered_map.hpp>
ordered_map() noexcept(noexcept(Container()));
Construct from Allocator
<nlohmann/ordered_map.hpp>
explicit
ordered_map(Allocator const& alloc) noexcept(noexcept(Container(alloc)));
Name | Description |
---|---|
alloc | The object to copy construct from |
<nlohmann/ordered_map.hpp>
ordered_map(
std::initializer_list<value_type> init,
Allocator const& alloc = Allocator());
<nlohmann/ordered_map.hpp>
template<class It>
ordered_map(
It first,
It last,
Allocator const& alloc = Allocator());
<nlohmann/ordered_map.hpp>
T&
at(key_type const& key);
» more...
T const&
at(key_type const& key) const;
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
at(KeyType&& key);
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
at(KeyType&& key) const;
» more...
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
at(KeyType&& key);
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
at(KeyType&& key) const;
<nlohmann/ordered_map.hpp>
size_type
count(key_type const& key) const;
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
count(KeyType&& key) const;
» more...
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
count(KeyType&& key) const;
<nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
emplace(
key_type const& key,
T&& t);
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
std::pair<iterator, bool>
emplace(
KeyType&& key,
T&& t);
» more...
<nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
emplace(
key_type const& key,
T&& t);
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
std::pair<iterator, bool>
emplace(
KeyType&& key,
T&& t);
<nlohmann/ordered_map.hpp>
iterator
erase(iterator pos);
» more...
size_type
erase(key_type const& key);
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
erase(KeyType&& key);
» more...
iterator
erase(
iterator first,
iterator last);
» more...
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
erase(KeyType&& key);
<nlohmann/ordered_map.hpp>
iterator
find(key_type const& key);
» more...
const_iterator
find(key_type const& key) const;
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
iterator
find(KeyType&& key);
» more...
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
iterator
find(KeyType&& key);
<nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
insert(value_type const& value);
» more...
std::pair<iterator, bool>
insert(value_type&& value);
» more...
template<
typename InputIt,
typename = require_input_iter<InputIt>>
void
insert(
InputIt first,
InputIt last);
» more...
<nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
insert(value_type const& value);
<nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
insert(value_type&& value);
<nlohmann/ordered_map.hpp>
template<
typename InputIt,
typename = require_input_iter<InputIt>>
void
insert(
InputIt first,
InputIt last);
Subscript operators
<nlohmann/ordered_map.hpp>
T&
operator[](key_type const& key);
» more...
T const&
operator[](key_type const& key) const;
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
operator[](KeyType&& key);
» more...
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
operator[](KeyType&& key) const;
» more...
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
operator[](KeyType&& key);
<nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
operator[](KeyType&& key) const;
<nlohmann/json.hpp>
[[__nonnull__]]
nlohmann::json
Unnamed function(
char const* s,
std::size_t n);
» more...
[[__nonnull__]]
nlohmann::json::json_pointer
Unnamed function(
char const* s,
std::size_t n);
» more...
<nlohmann/json.hpp>
[[__nonnull__]]
nlohmann::json
Unnamed function(
char const* s,
std::size_t n);
<nlohmann/json.hpp>
[[__nonnull__]]
nlohmann::json::json_pointer
Unnamed function(
char const* s,
std::size_t n);
Right shift operators
<nlohmann/json.hpp>
deserialize from stream
std::istream&
operator>>(
std::istream& i,
basic_json& j);
» more...
deserialize from stream
std::istream&
operator>>(
std::istream& i,
basic_json& j);
» more...
serialize to stream
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
» more...
serialize to stream
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
» more...
deserialize from stream
Name | Description |
---|---|
i | The left operand |
j | The right operand |
deserialize from stream
Name | Description |
---|---|
i | The left operand |
j | The right operand |
serialize to stream
<nlohmann/json.hpp>
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
Name | Description |
---|---|
j | The left operand |
o | The right operand |
serialize to stream
<nlohmann/json.hpp>
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
Name | Description |
---|---|
j | The left operand |
o | The right operand |
exchanges the values
<nlohmann/json.hpp>
exchanges the values
void
swap(
reference left,
reference right) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value);
» more...
exchanges the values
void
swap(
reference left,
reference right) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value);
» more...
exchanges the values
<nlohmann/json.hpp>
void
swap(
reference left,
reference right) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value);
Name | Description |
---|---|
left | the type of an element reference |
right | the type of an element reference |
exchanges the values
<nlohmann/json.hpp>
void
swap(
reference left,
reference right) noexcept(std::is_nothrow_move_constructible<value_t>::value && std::is_nothrow_move_assignable<value_t>::value && std::is_nothrow_move_constructible<json_value>::value && std::is_nothrow_move_assignable<json_value>::value);
Name | Description |
---|---|
left | the type of an element reference |
right | the type of an element reference |
user-defined to_string function for JSON values
<nlohmann/json.hpp>
template<
template<
typename,
typename,
typename...> typename ObjectType,
template<
typename,
typename...> typename ArrayType,
class StringType,
class BooleanType,
class NumberIntegerType,
class NumberUnsignedType,
class NumberFloatType,
template<typename> typename AllocatorType,
template<
typename,
typename = void> typename JSONSerializer,
class BinaryType,
class CustomBaseClass>
std::string
to_string(basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass> const& j);
Name | Description |
---|---|
j | a class to store JSON values |
Left shift operators
<nlohmann/json.hpp>
deserialize from stream
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
» more...
serialize to stream
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
» more...
write string representation of the JSON pointer to stream
std::ostream&
operator<<(
std::ostream& o,
json_pointer const& ptr);
» more...
deserialize from stream
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
» more...
serialize to stream
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
» more...
deserialize from stream
<nlohmann/json.hpp>
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
Name | Description |
---|---|
j | The left operand |
i | The right operand |
serialize to stream
<nlohmann/json.hpp>
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
Name | Description |
---|---|
o | An output stream |
j | The object to output |
deserialize from stream
<nlohmann/json.hpp>
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
Name | Description |
---|---|
j | The left operand |
i | The right operand |
serialize to stream
<nlohmann/json.hpp>
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
Name | Description |
---|---|
o | An output stream |
j | The object to output |
<nlohmann/json.hpp>
using nlohmann::literals::json_literals::;
Name |
---|
nlohmann:: |
<nlohmann/json.hpp>
using nlohmann::literals::json_literals::;
Name |
---|
nlohmann:: |