Namespaces
Name |
Description |
namespace for Niels Lohmann |
Using Declarations
nlohmann namespace
namespace for Niels Lohmann
Types
Name |
Description |
default JSONSerializer template argument |
|
a class to store JSON values |
|
an internal type for a backed binary type |
|
|
|
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
|
a minimal map‐like container that preserves insertion order |
|
default specialization |
|
specialization that maintains the insertion order of object keys |
Functions
Name |
Description |
Right shift operators |
|
exchanges the values |
|
user‐defined to_string function for JSON values |
|
Left shift operators |
See Also
https://github.com/nlohmann
namespace for Niels Lohmann
Types
Name |
Description |
default JSONSerializer template argument |
|
a class to store JSON values |
|
an internal type for a backed binary type |
|
|
|
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
|
a minimal map‐like container that preserves insertion order |
|
default specialization |
|
specialization that maintains the insertion order of object keys |
Functions
Name |
Description |
Right shift operators |
|
exchanges the values |
|
user‐defined to_string function for JSON values |
|
Left shift operators |
See Also
https://github.com/nlohmann
default specialization
Synopsis
Declared in <nlohmann/json_fwd.hpp>
using json = basic_json;
specialization that maintains the insertion order of object keys
Synopsis
Declared in <nlohmann/json_fwd.hpp>
using ordered_json = basic_json<ordered_map>;
default JSONSerializer template argument
Synopsis
Declared in <nlohmann/adl_serializer.hpp>
template<
typename T = void,
typename SFINAE = void>
struct adl_serializer;
Static Member Functions
Name |
Description |
convert a JSON value to any value type |
|
convert any value type to a JSON value |
Description
This serializer ignores the template arguments and uses ADL([argument‐dependent lookup](https://en.cppreference.com/w/cpp/language/adl))for serialization.
convert a JSON value to any value type
Synopses
Declared in <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>{})));
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)));
convert a JSON value to any value type
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <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))));
Synopsis
Declared in <nlohmann/json.hpp>
template<>
class basic_json<>
: public nlohmann::detail::json_base_class<void>
Base Classes
Name |
Description |
|
Types
Name |
Description |
the allocator type |
|
a type for an array |
|
a type for a packed binary type |
|
how to encode BJData |
|
a type for a boolean |
|
how to treat CBOR tags |
|
a const iterator for a basic_json container |
|
the type of an element const pointer |
|
the type of an element const reference |
|
a const reverse iterator for a basic_json container |
|
a type to represent differences between iterators |
|
how to treat decoding errors |
|
Classes to implement user‐defined exceptions. @{ |
|
helper type for initializer lists of basic_json values |
|
an iterator for a basic_json container |
|
JSON Pointer, see |
|
SAX interface type, see |
|
a type for a number (floating‐point) |
|
a type for a number (integer) |
|
a type for a number (unsigned) |
|
object key comparator type |
|
a type for an object |
|
parser event types |
|
per‐element parser callback type |
|
the type of an element pointer |
|
the type of an element reference |
|
a reverse iterator for a basic_json container |
|
a type to represent container sizes |
|
a type for a string |
|
the type of elements in a basic_json container |
Member Functions
Name |
Description |
|
Construct from |
|
Construct from |
|
Construct from |
|
Construct from |
|
create a JSON value from an existing one |
|
//////////////////////////////////// |
|
create a JSON value from compatible types |
|
Constructor |
|
construct a JSON container given an iterator range |
|
|
|
Destructor |
Assignment operator |
|
access specified object element with bounds checking |
|
access specified object element with bounds checking |
|
check the existence of an element in a JSON object |
|
returns the number of occurrences of a key in a JSON object |
|
add an object to an object if key does not exist |
|
add an object to an array |
|
remove element given an iterator |
|
remove element from a JSON object given a key |
|
remove elements given an iterator range |
|
find an element in a JSON object |
|
find an element in a JSON object |
|
get a pointer value (explicit) |
|
get a (pointer) value (explicit) |
|
get a pointer value (implicit) |
|
get a pointer value (implicit) |
|
get a reference value (implicit) |
|
get a reference value (implicit) |
|
get a value (explicit) |
|
Helper for insertion of an iterator |
|
Addition assignment operator |
|
Addition assignment operator |
|
Addition assignment operator |
|
Addition assignment operator |
|
Subscript operator |
|
Subscript operator |
|
Subscript operator |
|
Subscript operator |
|
Subscript operator |
|
Subscript operator |
|
Subscript operator |
|
Subscript operator |
|
access specified object element |
|
access specified object element |
|
Subscript operator |
|
Subscript operator |
|
access specified object element via JSON Pointer with default value |
|
access specified object element with default value |
|
access specified object element via JSON Pointer with default value |
|
access specified object element with default value |
|
access specified object element with default value |
|
access specified object element via JSON Pointer with default value |
|
get a value (implicit) |
|
Conversion to |
|
comparison: equal |
|
Equality operator |
|
Inequality operator |
|
comparison: 3‐way |
|
Three‐way comparison operator |
Static Member Functions
Name |
Description |
check if the input is valid JSON |
|
check if the input is valid JSON |
|
create a JSON value from an input in BJData format |
|
create a JSON value from an input in BJData format |
|
create a JSON value from an input in BSON format |
|
create a JSON value from an input in BSON format |
|
create a JSON value from an input in CBOR format |
|
create a JSON value from an input in CBOR format |
|
create a JSON value from an input in MessagePack format |
|
create a JSON value from an input in MessagePack format |
|
create a JSON value from an input in UBJSON format |
|
create a JSON value from an input in UBJSON format |
|
deserialize from a compatible input |
|
deserialize from a pair of character iterators |
|
generate SAX events |
|
generate SAX events |
|
generate SAX events |
|
Friends
Name |
Description |
deserialize from stream |
|
deserialize from stream |
|
serialize to stream |
|
serialize to stream |
|
exchanges the values |
|
|
general exception of the |
|
|
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
the allocator type
Synopsis
Declared in <nlohmann/json.hpp>
using allocator_type = allocator<basic_json>;
a type for an array
Synopsis
Declared in <nlohmann/json.hpp>
using array_t = vector<basic_json, allocator<basic_json>>;
a type for a packed binary type
Synopsis
Declared in <nlohmann/json.hpp>
using binary_t = nlohmann::byte_container_with_subtype<vector<unsigned char>>;
how to encode BJData
Synopsis
Declared in <nlohmann/json.hpp>
using bjdata_version_t = detail::bjdata_version_t;
a type for a boolean
Synopsis
Declared in <nlohmann/json.hpp>
using boolean_t = bool;
how to treat CBOR tags
Synopsis
Declared in <nlohmann/json.hpp>
using cbor_tag_handler_t = detail::cbor_tag_handler_t;
a const iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using const_iterator = iter_impl<basic_json const>;
the type of an element const pointer
Synopsis
Declared in <nlohmann/json.hpp>
using const_pointer = std::allocator_traits<allocator_type>::const_pointer;
the type of an element const reference
Synopsis
Declared in <nlohmann/json.hpp>
using const_reference = value_type const&;
a const reverse iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using const_reverse_iterator = json_reverse_iterator<basic_json::const_iterator>;
Synopsis
Declared in <nlohmann/json.hpp>
using default_object_comparator_t = std::less;
a type to represent differences between iterators
Synopsis
Declared in <nlohmann/json.hpp>
using difference_type = std::ptrdiff_t;
how to treat decoding errors
Synopsis
Declared in <nlohmann/json.hpp>
using error_handler_t = detail::error_handler_t;
Classes to implement user‐defined exceptions. @{
Synopsis
Declared in <nlohmann/json.hpp>
using exception = detail::exception;
helper type for initializer lists of basic_json values
Synopsis
Declared in <nlohmann/json.hpp>
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
Synopsis
Declared in <nlohmann/json.hpp>
using input_format_t = detail::input_format_t;
Synopsis
Declared in <nlohmann/json.hpp>
using invalid_iterator = detail::invalid_iterator;
an iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using iterator = iter_impl<basic_json>;
JSON Pointer, see nlohmann::json_pointer
Synopsis
Declared in <nlohmann/json.hpp>
using json_pointer = nlohmann::json_pointer<basic_string<char>>;
SAX interface type, see nlohmann::json_sax
Synopsis
Declared in <nlohmann/json.hpp>
using json_sax_t = json_sax<basic_json>;
Synopsis
Declared in <nlohmann/json.hpp>
template<
typename T,
typename SFINAE>
using json_serializer = adl_serializer<T, SFINAE>;
a type for a number (floating‐point)
Synopsis
Declared in <nlohmann/json.hpp>
using number_float_t = double;
a type for a number (integer)
Synopsis
Declared in <nlohmann/json.hpp>
using number_integer_t = long long;
a type for a number (unsigned)
Synopsis
Declared in <nlohmann/json.hpp>
using number_unsigned_t = unsigned long long;
object key comparator type
Synopsis
Declared in <nlohmann/json.hpp>
using object_comparator_t = detail::actual_object_comparator_t<basic_json>;
a type for an object
Synopsis
Declared in <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>>>;
Synopsis
Declared in <nlohmann/json.hpp>
using other_error = detail::other_error;
Synopsis
Declared in <nlohmann/json.hpp>
using out_of_range = detail::out_of_range;
Synopsis
Declared in <nlohmann/json.hpp>
using parse_error = detail::parse_error;
parser event types
Synopsis
Declared in <nlohmann/json.hpp>
using parse_event_t = detail::parse_event_t;
per‐element parser callback type
Synopsis
Declared in <nlohmann/json.hpp>
using parser_callback_t = detail::parser_callback_t<basic_json>;
the type of an element pointer
Synopsis
Declared in <nlohmann/json.hpp>
using pointer = std::allocator_traits<allocator_type>::pointer;
the type of an element reference
Synopsis
Declared in <nlohmann/json.hpp>
using reference = value_type&;
a reverse iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using reverse_iterator = json_reverse_iterator<basic_json::iterator>;
a type to represent container sizes
Synopsis
Declared in <nlohmann/json.hpp>
using size_type = std::size_t;
a type for a string
Synopsis
Declared in <nlohmann/json.hpp>
using string_t = basic_string<char>;
Synopsis
Declared in <nlohmann/json.hpp>
using type_error = detail::type_error;
Synopsis
Declared in <nlohmann/json.hpp>
using value_t = detail::value_t;
the type of elements in a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using value_type = basic_json;
Construct from nullptr_t
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(std::nullptr_t value = nullptr) noexcept;
Parameters
Name |
Description |
value |
The object to construct from |
Construct from value_t
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(value_t const v);
Parameters
Name |
Description |
v |
The object to construct from |
Construct from basic_json
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(basic_json const& other);
Parameters
Name |
Description |
other |
The object to copy construct from |
Construct from basic_json
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(basic_json&& other) noexcept;
Parameters
Name |
Description |
other |
The object to move construct from |
create a JSON value from an existing one
Synopsis
Declared in <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);
Parameters
Name |
Description |
val |
The object to copy construct from |
////////////////////////////////////
Synopsis
Declared in <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);
Parameters
Name |
Description |
ref |
The object to copy construct from |
create a JSON value from compatible types
Synopsis
Declared in <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))));
Parameters
Name |
Description |
val |
The object to move construct from |
Constructor
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(
size_type cnt,
basic_json const& val);
Parameters
Name |
Description |
cnt |
The object to construct from |
val |
a class to store JSON values |
construct a JSON container given an iterator range
Synopsis
Declared in <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);
Parameters
Name |
Description |
first |
The object to construct from |
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(
initializer_list_t init,
bool type_deduction = true,
value_t manual_type = value_t::array);
Destructor
Synopsis
Declared in <nlohmann/json.hpp>
~basic_json() noexcept;
Assignment operator
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
other |
The object to assign from |
Synopsis
Declared in <nlohmann/json.hpp>
reference
at(size_type idx);
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
at(size_type idx) const;
Synopsis
Declared in <nlohmann/json.hpp>
reference
at(json_pointer const& ptr);
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
at(json_pointer const& ptr) const;
Synopsis
Declared in <nlohmann/json.hpp>
reference
at(object_t::key_type const& key);
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
at(object_t::key_type const& key) const;
Synopsis
Declared in <nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
at(nlohmann::json_pointer<BasicJsonType> const& ptr);
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
at(KeyType&& key);
Return Value
the type of an element reference
access specified object element with bounds checking
Synopsis
Declared in <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;
Return Value
the type of an element const reference
Synopsis
Declared in <nlohmann/json.hpp>
reference
back();
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
back() const;
Synopsis
Declared in <nlohmann/json.hpp>
iterator
begin() noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
begin() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
cbegin() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
cend() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
void
clear() noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
bool
contains(json_pointer const& ptr) const;
Synopsis
Declared in <nlohmann/json.hpp>
bool
contains(object_t::key_type const& key) const;
Synopsis
Declared in <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
Synopsis
Declared in <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;
Synopsis
Declared in <nlohmann/json.hpp>
size_type
count(object_t::key_type const& key) const;
returns the number of occurrences of a key in a JSON object
Synopsis
Declared in <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;
Return Value
a type to represent container sizes
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
crbegin() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
crend() const noexcept;
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
template<class... Args>
std::pair<iterator, bool>
emplace(Args...&&... args);
add an object to an array
Synopsis
Declared in <nlohmann/json.hpp>
template<class... Args>
reference
emplace_back(Args...&&... args);
Return Value
the type of an element reference
Synopsis
Declared in <nlohmann/json.hpp>
bool
empty() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
iterator
end() noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
end() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
void
erase(size_type const idx);
Synopsis
Declared in <nlohmann/json.hpp>
size_type
erase(object_t::key_type const& key);
remove element given an iterator
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a type to represent container sizes
remove elements given an iterator range
Synopsis
Declared in <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);
Synopsis
Declared in <nlohmann/json.hpp>
iterator
find(object_t::key_type const& key);
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
find(object_t::key_type const& key) const;
find an element in a JSON object
Synopsis
Declared in <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 Value
a const iterator for a basic_json container
find an element in a JSON object
Synopsis
Declared in <nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
iterator
find(KeyType&& key);
Return Value
an iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
basic_json
flatten() const;
Synopsis
Declared in <nlohmann/json.hpp>
reference
front();
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
front() const;
get a pointer value (explicit)
Synopsis
Declared in <nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
get() noexcept;
Description
Explicit pointer access to the internally stored JSON value. No copies are made.
Warning
|
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}
Return Value
pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr
otherwise
Template Parameters
Name |
Description |
PointerType |
pointer type; must be a pointer to |
get a (pointer) value (explicit)
Synopsis
Declared in <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>{})));
Description
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.
Exceptions
Name |
Thrown on |
|
|
Return Value
copy of the JSON value, converted to
Template Parameters
Name |
Description |
ValueTypeCV |
the provided value type |
ValueType |
the returned value type |
ValueType |
if necessary |
Synopsis
Declared in <nlohmann/json.hpp>
binary_t&
get_binary();
Synopsis
Declared in <nlohmann/json.hpp>
binary_t const&
get_binary() const;
get a pointer value (implicit)
Synopsis
Declared in <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 pointer value (implicit)
Synopsis
Declared in <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 reference value (implicit)
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ReferenceType>
requires std::is_reference<ReferenceType>::value
ReferenceType
get_ref();
get a reference value (implicit)
Synopsis
Declared in <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)
Synopsis
Declared in <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)));
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ValueType>
requires detail::is_basic_json<ValueType>::value
ValueType&
get_to(ValueType& v) const;
Synopsis
Declared in <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)));
Synopsis
Declared in <nlohmann/json.hpp>
void
insert(
const_iterator first,
const_iterator last);
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
initializer_list_t ilist);
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
basic_json const& val);
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
basic_json&& val);
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
const_iterator first,
const_iterator last);
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
size_type cnt,
basic_json const& val);
Helper for insertion of an iterator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename... Args>
iterator
insert_iterator(
const_iterator pos,
Args...&&... args);
Description
Note
|
: This uses std::distance to support GCC 4.8, see https://github.com/nlohmann/json/pull/1257 |
Return Value
an iterator for a basic_json container
Parameters
Name |
Description |
pos |
a const iterator for a basic_json container |
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_array() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_binary() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_boolean() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_discarded() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_null() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number_float() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number_integer() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number_unsigned() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_object() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_primitive() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_string() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_structured() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
iteration_proxy<iterator>
items() noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
iteration_proxy<const_iterator>
items() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
size_type
max_size() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
void
merge_patch(basic_json const& apply_patch);
Addition assignment operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(initializer_list_t init);
Return Value
the type of an element reference
Parameters
Name |
Description |
init |
The right operand |
Addition assignment operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(object_t::value_type const& val);
Return Value
the type of an element reference
Parameters
Name |
Description |
val |
The right operand |
Addition assignment operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(basic_json const& val);
Return Value
the type of an element reference
Parameters
Name |
Description |
val |
The right operand |
Addition assignment operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(basic_json&& val);
Return Value
the type of an element reference
Parameters
Name |
Description |
val |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator[](object_t::key_type key);
Return Value
the type of an element reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator[](size_type idx);
Return Value
the type of an element reference
Parameters
Name |
Description |
idx |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
operator[](size_type idx) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
idx |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator[](json_pointer const& ptr);
Return Value
the type of an element reference
Parameters
Name |
Description |
ptr |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
operator[](json_pointer const& ptr) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
ptr |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
operator[](object_t::key_type const& key) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
const_reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
ptr |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr);
Return Value
the type of an element reference
Parameters
Name |
Description |
ptr |
The right operand |
access specified object element
Synopsis
Declared in <nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
operator[](KeyType&& key);
Return Value
the type of an element reference
Parameters
Name |
Description |
key |
The right operand |
access specified object element
Synopsis
Declared in <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;
Return Value
the type of an element const reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename T>
reference
operator[](T* key);
Return Value
the type of an element reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename T>
const_reference
operator[](T* key) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
key |
The right operand |
Synopsis
Declared in <nlohmann/json.hpp>
basic_json
patch(basic_json const& json_patch) const;
Synopsis
Declared in <nlohmann/json.hpp>
void
patch_inplace(basic_json const& json_patch);
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(initializer_list_t init);
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(object_t::value_type const& val);
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(basic_json const& val);
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(basic_json&& val);
Synopsis
Declared in <nlohmann/json.hpp>
reverse_iterator
rbegin() noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
rbegin() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
reverse_iterator
rend() noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
rend() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
size_type
size() const noexcept;
Synopsis
Declared in <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);
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(array_t& other);
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(binary_t& other);
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(binary_t::container_type& other);
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(object_t& other);
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(string_t& other);
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
value_t
type() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
[[__returns_nonnull__]]
char const*
type_name() const noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
basic_json
unflatten() const;
Synopsis
Declared in <nlohmann/json.hpp>
void
update(
const_reference j,
bool merge_objects = false);
Synopsis
Declared in <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
Synopsis
Declared in <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;
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
access specified object element with default value
Synopsis
Declared in <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
Synopsis
Declared in <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;
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
access specified object element with default value
Synopsis
Declared in <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;
Synopsis
Declared in <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
Synopsis
Declared in <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;
Synopsis
Declared in <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
Synopsis
Declared in <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)
Synopsis
Declared in <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;
Description
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}
Exceptions
Name |
Thrown on |
|
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 |
Return Value
copy of the JSON value, converted to type ValueType
Template Parameters
Name |
Description |
ValueType |
non‐pointer type compatible to the JSON value, for instance |
Conversion to value_t
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
operator value_t() const noexcept;
Return Value
The object converted to value_t
comparison: equal
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
bool
operator==(ScalarType rhs) const noexcept;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
Equality operator
Synopsis
Declared in <nlohmann/json.hpp>
bool
operator==(const_reference rhs) const noexcept;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
Inequality operator
Synopsis
Declared in <nlohmann/json.hpp>
bool
operator!=(const_reference rhs) const noexcept;
Return Value
true
if the objects are not equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
comparison: 3‐way
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
std::partial_ordering
operator<=>(ScalarType rhs) const noexcept;
Return Value
The relative order of the objects
Parameters
Name |
Description |
rhs |
The right operand |
Three‐way comparison operator
Synopsis
Declared in <nlohmann/json.hpp>
std::partial_ordering
operator<=>(const_reference rhs) const noexcept;
Return Value
The relative order of the objects
Parameters
Name |
Description |
rhs |
The right operand |
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
template<typename IteratorType>
static
bool
accept(
IteratorType first,
IteratorType last,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
array(initializer_list_t init = {});
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type const& init);
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type&& init);
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type const& init,
binary_t::subtype_type subtype);
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type&& init,
binary_t::subtype_type subtype);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in BJData format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in BSON format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
tag_handler |
how to treat CBOR tags |
create a JSON value from an input in CBOR format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
tag_handler |
how to treat CBOR tags |
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in MessagePack format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in UBJSON format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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);
Synopsis
Declared in <nlohmann/json.hpp>
static
allocator_type
get_allocator();
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<const_iterator>
iterator_wrapper(const_reference ref) noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<iterator>
iterator_wrapper(reference ref) noexcept;
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
meta();
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
object(initializer_list_t init = {});
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
cb |
per‐element parser callback type |
deserialize from a pair of character iterators
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
cb |
per‐element parser callback type |
generate SAX events
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <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);
Synopsis
Declared in <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);
Synopsis
Declared in <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);
Synopsis
Declared in <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);
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_bson(basic_json const& j);
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<char> o);
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_cbor(basic_json const& j);
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<char> o);
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_msgpack(basic_json const& j);
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<char> o);
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_ubjson(
basic_json const& j,
bool const use_size = false,
bool const use_type = false);
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
template<
template<
typename U,
typename V,
typename... Args> typename ObjectType = map,
template<
typename U,
typename... Args> typename ArrayType = vector,
class StringType = std::string,
class BooleanType = bool,
class NumberIntegerType = int64_t,
class NumberUnsignedType = uint64_t,
class NumberFloatType = double,
template<typename U> typename AllocatorType = allocator,
template<
typename T,
typename SFINAE = void> typename JSONSerializer = adl_serializer,
class BinaryType = std::vector<uint8_t>,
class CustomBaseClass = void>
class basic_json
: public nlohmann::detail::json_base_class<CustomBaseClass>
Base Classes
Name |
Description |
|
Types
Name |
Description |
the allocator type |
|
a type for an array |
|
a type for a packed binary type |
|
how to encode BJData |
|
a type for a boolean |
|
how to treat CBOR tags |
|
a const iterator for a basic_json container |
|
the type of an element const pointer |
|
the type of an element const reference |
|
a const reverse iterator for a basic_json container |
|
a type to represent differences between iterators |
|
how to treat decoding errors |
|
Classes to implement user‐defined exceptions. @{ |
|
helper type for initializer lists of basic_json values |
|
an iterator for a basic_json container |
|
JSON Pointer, see |
|
SAX interface type, see |
|
a type for a number (floating‐point) |
|
a type for a number (integer) |
|
a type for a number (unsigned) |
|
object key comparator type |
|
a type for an object |
|
parser event types |
|
per‐element parser callback type |
|
the type of an element pointer |
|
the type of an element reference |
|
a reverse iterator for a basic_json container |
|
a type to represent container sizes |
|
a type for a string |
|
the type of elements in a basic_json container |
Member Functions
Name |
Description |
|
copy constructor |
|
move constructor |
|
create a null object |
|
create an empty value with a given type |
|
create a JSON value from an existing one |
|
//////////////////////////////////// |
|
create a JSON value from compatible types |
|
construct an array with count copies of given value |
|
construct a JSON container given an iterator range |
|
create a container (array or object) from an initializer list |
|
destructor |
copy assignment |
|
access specified array element with bounds checking |
|
access specified array element with bounds checking |
|
access specified element via JSON Pointer |
|
access specified element via JSON Pointer |
|
access specified object element with bounds checking |
|
access specified object element with bounds checking |
|
access specified object element with bounds checking |
|
access specified object element with bounds checking |
|
access the last element |
|
access the last element |
|
returns an iterator to the first element |
|
returns an iterator to the first element |
|
returns a const iterator to the first element |
|
returns an iterator to one past the last element |
|
clears the contents |
|
check the existence of an element in a JSON object given a JSON pointer |
|
check the existence of an element in a JSON object |
|
check the existence of an element in a JSON object |
|
returns the number of occurrences of a key in a JSON object |
|
returns the number of occurrences of a key in a JSON object |
|
returns a const reverse iterator to the last element |
|
returns a const reverse iterator to one before the first |
|
serialization |
|
add an object to an object if key does not exist |
|
add an object to an array |
|
checks whether the container is empty. |
|
returns an iterator to one past the last element |
|
returns an iterator to one past the last element |
|
remove element from a JSON array given an index |
|
remove element from a JSON object given a key |
|
remove element given an iterator |
|
remove element from a JSON object given a key |
|
remove elements given an iterator range |
|
find an element in a JSON object |
|
find an element in a JSON object |
|
find an element in a JSON object |
|
find an element in a JSON object |
|
return flattened JSON value |
|
access the first element |
|
access the first element |
|
get a pointer value (explicit) |
|
get a (pointer) value (explicit) |
|
get a binary value |
|
get a binary value |
|
get a pointer value (implicit) |
|
get a pointer value (implicit) |
|
get a reference value (implicit) |
|
get a reference value (implicit) |
|
get a value (explicit) |
|
inserts range of elements into object |
|
inserts elements from initializer list into array |
|
inserts element into array |
|
inserts element into array |
|
inserts range of elements into array |
|
inserts copies of element into array |
|
Helper for insertion of an iterator |
|
return whether value is an array |
|
return whether value is a binary array |
|
return whether value is a boolean |
|
return whether value is discarded |
|
return whether value is null |
|
return whether value is a number |
|
return whether value is a floating‐point number |
|
return whether value is an integer number |
|
return whether value is an unsigned integer number |
|
return whether value is an object |
|
return whether type is primitive |
|
return whether value is a string |
|
return whether type is structured |
|
helper to access iterator member functions in range‐based for |
|
helper to access iterator member functions in range‐based for |
|
returns the maximum possible number of elements |
|
applies a JSON Merge Patch |
|
add an object to an object |
|
add an object to an array |
|
add an object to an object |
|
add an object to an array |
|
access specified object element |
|
access specified array element |
|
access specified array element |
|
access specified element via JSON Pointer |
|
access specified element via JSON Pointer |
|
access specified object element |
|
Subscript operator |
|
Subscript operator |
|
access specified object element |
|
access specified object element |
|
Subscript operator |
|
Subscript operator |
|
applies a JSON patch to a copy of the current object |
|
applies a JSON patch in‐place without copying the object |
|
add an object to an object |
|
add an object to an array |
|
add an object to an object |
|
add an object to an array |
|
returns an iterator to the reverse‐beginning |
|
returns an iterator to the reverse‐beginning |
|
returns an iterator to the reverse‐end |
|
returns an iterator to the reverse‐end |
|
returns the number of elements |
|
exchanges the values |
|
exchanges the values |
|
exchanges the values |
|
exchanges the values |
|
exchanges the values |
|
exchanges the values |
|
return the type of the JSON value (explicit) |
|
return the type as string |
|
unflatten a previously flattened JSON value |
|
updates a JSON object from another object, overwriting existing keys |
|
updates a JSON object from another object, overwriting existing keys |
|
access specified object element via JSON Pointer with default value |
|
access specified object element with default value |
|
access specified object element via JSON Pointer with default value |
|
access specified object element with default value |
|
access specified object element with default value |
|
access specified object element via JSON Pointer with default value |
|
get a value (implicit) |
|
return the type of the JSON value (implicit) |
|
comparison: equal |
|
comparison: equal |
|
comparison: not equal |
|
comparison: 3‐way |
|
comparison: 3‐way |
Static Member Functions
Name |
Description |
check if the input is valid JSON |
|
check if the input is valid JSON |
|
explicitly create an array from an initializer list |
|
explicitly create a binary array (without subtype) |
|
explicitly create a binary array |
|
explicitly create a binary array (with subtype) |
|
explicitly create a binary array (with subtype) |
|
creates a diff as a JSON patch |
|
create a JSON value from an input in BJData format |
|
create a JSON value from an input in BJData format |
|
create a JSON value from an input in BSON format |
|
create a JSON value from an input in BSON format |
|
create a JSON value from an input in CBOR format |
|
create a JSON value from an input in CBOR format |
|
create a JSON value from an input in MessagePack format |
|
create a JSON value from an input in MessagePack format |
|
create a JSON value from an input in UBJSON format |
|
create a JSON value from an input in UBJSON format |
|
returns the allocator associated with the container |
|
wrapper to access iterator member functions in range‐based for |
|
wrapper to access iterator member functions in range‐based for |
|
returns version information on the library |
|
explicitly create an object from an initializer list |
|
deserialize from a compatible input |
|
deserialize from a pair of character iterators |
|
generate SAX events |
|
generate SAX events |
|
generate SAX events |
|
create a BJData serialization of a given JSON value |
|
create a BJData serialization of a given JSON value |
|
create a BJData serialization of a given JSON value |
|
create a BSON serialization of a given JSON value |
|
create a BSON serialization of a given JSON value |
|
create a BSON serialization of a given JSON value |
|
create a CBOR serialization of a given JSON value |
|
create a CBOR serialization of a given JSON value |
|
create a CBOR serialization of a given JSON value |
|
create a MessagePack serialization of a given JSON value |
|
create a MessagePack serialization of a given JSON value |
|
create a MessagePack serialization of a given JSON value |
|
create a UBJSON serialization of a given JSON value |
|
create a UBJSON serialization of a given JSON value |
|
create a UBJSON serialization of a given JSON value |
Friends
Name |
Description |
deserialize from stream |
|
deserialize from stream |
|
serialize to stream |
|
serialize to stream |
|
exchanges the values |
|
|
general exception of the |
|
|
Non-Member Functions
Name |
Description |
deserialize from stream |
|
serialize to stream |
|
user‐defined to_string function for JSON values |
Description
a class to store JSON values
@invariant The member variables @a m_value and @a m_type have the following
relationship:
- If `m_type == value_t::object`, then `m_value.object != nullptr`.
- If `m_type == value_t::array`, then `m_value.array != nullptr`.
- If `m_type == value_t::string`, then `m_value.string != nullptr`.
The invariants are checked by member function assert_invariant().
@note ObjectType trick from https://stackoverflow.com/a/9860911
the allocator type
Synopsis
Declared in <nlohmann/json.hpp>
using allocator_type = AllocatorType<basic_json>;
a type for an array
Synopsis
Declared in <nlohmann/json.hpp>
using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
a type for a packed binary type
Synopsis
Declared in <nlohmann/json.hpp>
using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;
how to encode BJData
Synopsis
Declared in <nlohmann/json.hpp>
using bjdata_version_t = detail::bjdata_version_t;
a type for a boolean
Synopsis
Declared in <nlohmann/json.hpp>
using boolean_t = BooleanType;
how to treat CBOR tags
Synopsis
Declared in <nlohmann/json.hpp>
using cbor_tag_handler_t = detail::cbor_tag_handler_t;
a const iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using const_iterator = iter_impl<basic_json const>;
the type of an element const pointer
Synopsis
Declared in <nlohmann/json.hpp>
using const_pointer = std::allocator_traits<allocator_type>::const_pointer;
the type of an element const reference
Synopsis
Declared in <nlohmann/json.hpp>
using const_reference = value_type const&;
a const reverse iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using const_reverse_iterator = json_reverse_iterator<basic_json::const_iterator>;
Synopsis
Declared in <nlohmann/json.hpp>
using default_object_comparator_t = std::less;
a type to represent differences between iterators
Synopsis
Declared in <nlohmann/json.hpp>
using difference_type = std::ptrdiff_t;
how to treat decoding errors
Synopsis
Declared in <nlohmann/json.hpp>
using error_handler_t = detail::error_handler_t;
Classes to implement user‐defined exceptions. @{
Synopsis
Declared in <nlohmann/json.hpp>
using exception = detail::exception;
helper type for initializer lists of basic_json values
Synopsis
Declared in <nlohmann/json.hpp>
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
Synopsis
Declared in <nlohmann/json.hpp>
using input_format_t = detail::input_format_t;
Synopsis
Declared in <nlohmann/json.hpp>
using invalid_iterator = detail::invalid_iterator;
an iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using iterator = iter_impl<basic_json>;
JSON Pointer, see nlohmann::json_pointer
Synopsis
Declared in <nlohmann/json.hpp>
using json_pointer = nlohmann::json_pointer<StringType>;
SAX interface type, see nlohmann::json_sax
Synopsis
Declared in <nlohmann/json.hpp>
using json_sax_t = json_sax<basic_json>;
Synopsis
Declared in <nlohmann/json.hpp>
template<
typename T,
typename SFINAE>
using json_serializer = JSONSerializer<T, SFINAE>;
a type for a number (floating‐point)
Synopsis
Declared in <nlohmann/json.hpp>
using number_float_t = NumberFloatType;
a type for a number (integer)
Synopsis
Declared in <nlohmann/json.hpp>
using number_integer_t = NumberIntegerType;
a type for a number (unsigned)
Synopsis
Declared in <nlohmann/json.hpp>
using number_unsigned_t = NumberUnsignedType;
object key comparator type
Synopsis
Declared in <nlohmann/json.hpp>
using object_comparator_t = detail::actual_object_comparator_t<basic_json>;
a type for an object
Synopsis
Declared in <nlohmann/json.hpp>
using object_t = ObjectType<StringType, basic_json, default_object_comparator_t, AllocatorType<std::pair<StringType const, basic_json>>>;
Synopsis
Declared in <nlohmann/json.hpp>
using other_error = detail::other_error;
Synopsis
Declared in <nlohmann/json.hpp>
using out_of_range = detail::out_of_range;
Synopsis
Declared in <nlohmann/json.hpp>
using parse_error = detail::parse_error;
parser event types
Synopsis
Declared in <nlohmann/json.hpp>
using parse_event_t = detail::parse_event_t;
per‐element parser callback type
Synopsis
Declared in <nlohmann/json.hpp>
using parser_callback_t = detail::parser_callback_t<basic_json>;
the type of an element pointer
Synopsis
Declared in <nlohmann/json.hpp>
using pointer = std::allocator_traits<allocator_type>::pointer;
the type of an element reference
Synopsis
Declared in <nlohmann/json.hpp>
using reference = value_type&;
a reverse iterator for a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using reverse_iterator = json_reverse_iterator<basic_json::iterator>;
a type to represent container sizes
Synopsis
Declared in <nlohmann/json.hpp>
using size_type = std::size_t;
a type for a string
Synopsis
Declared in <nlohmann/json.hpp>
using string_t = StringType;
Synopsis
Declared in <nlohmann/json.hpp>
using type_error = detail::type_error;
Synopsis
Declared in <nlohmann/json.hpp>
using value_t = detail::value_t;
the type of elements in a basic_json container
Synopsis
Declared in <nlohmann/json.hpp>
using value_type = basic_json;
copy constructor
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(basic_json const& other);
Parameters
Name |
Description |
other |
The object to copy construct from |
move constructor
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(basic_json&& other) noexcept;
Parameters
Name |
Description |
other |
The object to move construct from |
create a null object
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(std::nullptr_t value = nullptr) noexcept;
Parameters
Name |
Description |
value |
The object to construct from |
create an empty value with a given type
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(value_t const v);
Parameters
Name |
Description |
v |
The object to construct from |
create a JSON value from an existing one
Synopsis
Declared in <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);
Parameters
Name |
Description |
val |
The object to copy construct from |
////////////////////////////////////
Synopsis
Declared in <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);
Parameters
Name |
Description |
ref |
The object to copy construct from |
create a JSON value from compatible types
Synopsis
Declared in <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))));
Parameters
Name |
Description |
val |
The object to move construct from |
construct an array with count copies of given value
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(
size_type cnt,
basic_json const& val);
Parameters
Name |
Description |
cnt |
The object to construct from |
val |
a class to store JSON values |
construct a JSON container given an iterator range
Synopsis
Declared in <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);
Parameters
Name |
Description |
first |
The object to construct from |
create a container (array or object) from an initializer list
Synopsis
Declared in <nlohmann/json.hpp>
basic_json(
initializer_list_t init,
bool type_deduction = true,
value_t manual_type = value_t::array);
Parameters
Name |
Description |
init |
The object to construct from |
destructor
Synopsis
Declared in <nlohmann/json.hpp>
~basic_json() noexcept;
copy assignment
Synopsis
Declared in <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);
Return Value
Reference to the current object
Parameters
Name |
Description |
other |
The object to assign from |
access specified array element with bounds checking
Synopsis
Declared in <nlohmann/json.hpp>
reference
at(size_type idx);
Return Value
the type of an element reference
Parameters
Name |
Description |
idx |
a type to represent container sizes |
access specified array element with bounds checking
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
at(size_type idx) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
idx |
a type to represent container sizes |
access specified element via JSON Pointer
Synopsis
Declared in <nlohmann/json.hpp>
reference
at(json_pointer const& ptr);
Return Value
the type of an element reference
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
access specified element via JSON Pointer
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
at(json_pointer const& ptr) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
access specified object element with bounds checking
Synopsis
Declared in <nlohmann/json.hpp>
reference
at(object_t::key_type const& key);
Return Value
the type of an element reference
access specified object element with bounds checking
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
at(object_t::key_type const& key) const;
Return Value
the type of an element const reference
Synopsis
Declared in <nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
at(nlohmann::json_pointer<BasicJsonType> const& ptr);
Synopsis
Declared in <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
Synopsis
Declared in <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;
Return Value
the type of an element const reference
access specified object element with bounds checking
Synopsis
Declared in <nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
at(KeyType&& key);
Return Value
the type of an element reference
access the last element
Synopsis
Declared in <nlohmann/json.hpp>
reference
back();
Return Value
the type of an element reference
access the last element
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
back() const;
Return Value
the type of an element const reference
returns an iterator to the first element
Synopsis
Declared in <nlohmann/json.hpp>
iterator
begin() noexcept;
Return Value
an iterator for a basic_json container
returns an iterator to the first element
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
begin() const noexcept;
Return Value
a const iterator for a basic_json container
returns a const iterator to the first element
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
cbegin() const noexcept;
Return Value
a const iterator for a basic_json container
returns an iterator to one past the last element
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
cend() const noexcept;
Return Value
a const iterator for a basic_json container
clears the contents
Synopsis
Declared in <nlohmann/json.hpp>
void
clear() noexcept;
check the existence of an element in a JSON object given a JSON pointer
Synopsis
Declared in <nlohmann/json.hpp>
bool
contains(json_pointer const& ptr) const;
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
check the existence of an element in a JSON object
Synopsis
Declared in <nlohmann/json.hpp>
bool
contains(object_t::key_type const& key) const;
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
size_type
count(object_t::key_type const& key) const;
Return Value
a type to represent container sizes
returns the number of occurrences of a key in a JSON object
Synopsis
Declared in <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;
Return Value
a type to represent container sizes
returns a const reverse iterator to the last element
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
crbegin() const noexcept;
Return Value
a const reverse iterator for a basic_json container
returns a const reverse iterator to one before the first
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
crend() const noexcept;
Return Value
a const reverse iterator for a basic_json container
serialization
Synopsis
Declared in <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;
Return Value
a type for a string
Parameters
Name |
Description |
error_handler |
how to treat decoding errors |
add an object to an object if key does not exist
Synopsis
Declared in <nlohmann/json.hpp>
template<class... Args>
std::pair<iterator, bool>
emplace(Args...&&... args);
add an object to an array
Synopsis
Declared in <nlohmann/json.hpp>
template<class... Args>
reference
emplace_back(Args...&&... args);
Return Value
the type of an element reference
checks whether the container is empty.
Synopsis
Declared in <nlohmann/json.hpp>
bool
empty() const noexcept;
returns an iterator to one past the last element
Synopsis
Declared in <nlohmann/json.hpp>
iterator
end() noexcept;
Return Value
an iterator for a basic_json container
returns an iterator to one past the last element
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
end() const noexcept;
Return Value
a const iterator for a basic_json container
remove element from a JSON array given an index
Synopsis
Declared in <nlohmann/json.hpp>
void
erase(size_type const idx);
Parameters
Name |
Description |
idx |
a type to represent container sizes |
remove element from a JSON object given a key
Synopsis
Declared in <nlohmann/json.hpp>
size_type
erase(object_t::key_type const& key);
Return Value
a type to represent container sizes
remove element given an iterator
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a type to represent container sizes
remove elements given an iterator range
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
iterator
find(object_t::key_type const& key);
Return Value
an iterator for a basic_json container
find an element in a JSON object
Synopsis
Declared in <nlohmann/json.hpp>
const_iterator
find(object_t::key_type const& key) const;
Return Value
a const iterator for a basic_json container
find an element in a JSON object
Synopsis
Declared in <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 Value
a const iterator for a basic_json container
find an element in a JSON object
Synopsis
Declared in <nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
iterator
find(KeyType&& key);
Return Value
an iterator for a basic_json container
return flattened JSON value
Synopsis
Declared in <nlohmann/json.hpp>
basic_json
flatten() const;
Return Value
a class to store JSON values
access the first element
Synopsis
Declared in <nlohmann/json.hpp>
reference
front();
Return Value
the type of an element reference
access the first element
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
front() const;
Return Value
the type of an element const reference
get a pointer value (explicit)
Synopsis
Declared in <nlohmann/json.hpp>
template<typename PointerType>
requires std::is_pointer<PointerType>::value
decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
get() noexcept;
Description
Explicit pointer access to the internally stored JSON value. No copies are made.
Warning
|
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}
Return Value
pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr
otherwise
Template Parameters
Name |
Description |
PointerType |
pointer type; must be a pointer to |
get a (pointer) value (explicit)
Synopsis
Declared in <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>{})));
Description
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.
Exceptions
Name |
Thrown on |
|
|
Return Value
copy of the JSON value, converted to
Template Parameters
Name |
Description |
ValueTypeCV |
the provided value type |
ValueType |
the returned value type |
ValueType |
if necessary |
get a binary value
Synopsis
Declared in <nlohmann/json.hpp>
binary_t&
get_binary();
Return Value
a type for a packed binary type
get a binary value
Synopsis
Declared in <nlohmann/json.hpp>
binary_t const&
get_binary() const;
Return Value
a type for a packed binary type
get a pointer value (implicit)
Synopsis
Declared in <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 pointer value (implicit)
Synopsis
Declared in <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 reference value (implicit)
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ReferenceType>
requires std::is_reference<ReferenceType>::value
ReferenceType
get_ref();
get a reference value (implicit)
Synopsis
Declared in <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)
Synopsis
Declared in <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)));
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ValueType>
requires detail::is_basic_json<ValueType>::value
ValueType&
get_to(ValueType& v) const;
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
void
insert(
const_iterator first,
const_iterator last);
Parameters
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
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
initializer_list_t ilist);
Return Value
an iterator for a basic_json container
Parameters
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
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
basic_json const& val);
Return Value
an iterator for a basic_json container
Parameters
Name |
Description |
pos |
a const iterator for a basic_json container |
val |
a class to store JSON values |
inserts element into array
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
basic_json&& val);
Return Value
an iterator for a basic_json container
Parameters
Name |
Description |
pos |
a const iterator for a basic_json container |
val |
a class to store JSON values |
inserts range of elements into array
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
const_iterator first,
const_iterator last);
Return Value
an iterator for a basic_json container
Parameters
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
Synopsis
Declared in <nlohmann/json.hpp>
iterator
insert(
const_iterator pos,
size_type cnt,
basic_json const& val);
Return Value
an iterator for a basic_json container
Parameters
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
Synopsis
Declared in <nlohmann/json.hpp>
template<typename... Args>
iterator
insert_iterator(
const_iterator pos,
Args...&&... args);
Description
Note
|
: This uses std::distance to support GCC 4.8, see https://github.com/nlohmann/json/pull/1257 |
Return Value
an iterator for a basic_json container
Parameters
Name |
Description |
pos |
a const iterator for a basic_json container |
return whether value is an array
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_array() const noexcept;
return whether value is a binary array
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_binary() const noexcept;
return whether value is a boolean
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_boolean() const noexcept;
return whether value is discarded
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_discarded() const noexcept;
return whether value is null
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_null() const noexcept;
return whether value is a number
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number() const noexcept;
return whether value is a floating‐point number
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number_float() const noexcept;
return whether value is an integer number
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number_integer() const noexcept;
return whether value is an unsigned integer number
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_number_unsigned() const noexcept;
return whether value is an object
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_object() const noexcept;
return whether type is primitive
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_primitive() const noexcept;
return whether value is a string
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_string() const noexcept;
return whether type is structured
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
bool
is_structured() const noexcept;
helper to access iterator member functions in range‐based for
Synopsis
Declared in <nlohmann/json.hpp>
iteration_proxy<iterator>
items() noexcept;
helper to access iterator member functions in range‐based for
Synopsis
Declared in <nlohmann/json.hpp>
iteration_proxy<const_iterator>
items() const noexcept;
returns the maximum possible number of elements
Synopsis
Declared in <nlohmann/json.hpp>
size_type
max_size() const noexcept;
Return Value
a type to represent container sizes
applies a JSON Merge Patch
Synopsis
Declared in <nlohmann/json.hpp>
void
merge_patch(basic_json const& apply_patch);
Parameters
Name |
Description |
apply_patch |
a class to store JSON values |
add an object to an object
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(initializer_list_t init);
Return Value
the type of an element reference
Parameters
Name |
Description |
init |
The right operand |
add an object to an array
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(basic_json const& val);
Return Value
the type of an element reference
Parameters
Name |
Description |
val |
The right operand |
add an object to an object
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(object_t::value_type const& val);
Return Value
the type of an element reference
Parameters
Name |
Description |
val |
The right operand |
add an object to an array
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator+=(basic_json&& val);
Return Value
the type of an element reference
Parameters
Name |
Description |
val |
The right operand |
access specified object element
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator[](object_t::key_type key);
Return Value
the type of an element reference
Parameters
Name |
Description |
key |
The right operand |
access specified array element
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator[](size_type idx);
Return Value
the type of an element reference
Parameters
Name |
Description |
idx |
The right operand |
access specified array element
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
operator[](size_type idx) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
idx |
The right operand |
access specified element via JSON Pointer
Synopsis
Declared in <nlohmann/json.hpp>
reference
operator[](json_pointer const& ptr);
Return Value
the type of an element reference
Parameters
Name |
Description |
ptr |
The right operand |
access specified element via JSON Pointer
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
operator[](json_pointer const& ptr) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
ptr |
The right operand |
access specified object element
Synopsis
Declared in <nlohmann/json.hpp>
const_reference
operator[](object_t::key_type const& key) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
const_reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
ptr |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename BasicJsonType>
requires detail::is_basic_json<BasicJsonType>::value
[[__deprecated__]]
reference
operator[](nlohmann::json_pointer<BasicJsonType> const& ptr);
Return Value
the type of an element reference
Parameters
Name |
Description |
ptr |
The right operand |
access specified object element
Synopsis
Declared in <nlohmann/json.hpp>
template<class KeyType>
requires detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value
reference
operator[](KeyType&& key);
Return Value
the type of an element reference
Parameters
Name |
Description |
key |
The right operand |
access specified object element
Synopsis
Declared in <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;
Return Value
the type of an element const reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename T>
reference
operator[](T* key);
Return Value
the type of an element reference
Parameters
Name |
Description |
key |
The right operand |
Subscript operator
Synopsis
Declared in <nlohmann/json.hpp>
template<typename T>
const_reference
operator[](T* key) const;
Return Value
the type of an element const reference
Parameters
Name |
Description |
key |
The right operand |
applies a JSON patch to a copy of the current object
Synopsis
Declared in <nlohmann/json.hpp>
basic_json
patch(basic_json const& json_patch) const;
Return Value
a class to store JSON values
Parameters
Name |
Description |
json_patch |
a class to store JSON values |
applies a JSON patch in‐place without copying the object
Synopsis
Declared in <nlohmann/json.hpp>
void
patch_inplace(basic_json const& json_patch);
Parameters
Name |
Description |
json_patch |
a class to store JSON values |
add an object to an object
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(initializer_list_t init);
Parameters
Name |
Description |
init |
helper type for initializer lists of basic_json values |
add an object to an array
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(basic_json const& val);
Parameters
Name |
Description |
val |
a class to store JSON values |
add an object to an object
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(object_t::value_type const& val);
add an object to an array
Synopsis
Declared in <nlohmann/json.hpp>
void
push_back(basic_json&& val);
Parameters
Name |
Description |
val |
a class to store JSON values |
returns an iterator to the reverse‐beginning
Synopsis
Declared in <nlohmann/json.hpp>
reverse_iterator
rbegin() noexcept;
Return Value
a reverse iterator for a basic_json container
returns an iterator to the reverse‐beginning
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
rbegin() const noexcept;
Return Value
a const reverse iterator for a basic_json container
returns an iterator to the reverse‐end
Synopsis
Declared in <nlohmann/json.hpp>
reverse_iterator
rend() noexcept;
Return Value
a reverse iterator for a basic_json container
returns an iterator to the reverse‐end
Synopsis
Declared in <nlohmann/json.hpp>
const_reverse_iterator
rend() const noexcept;
Return Value
a const reverse iterator for a basic_json container
returns the number of elements
Synopsis
Declared in <nlohmann/json.hpp>
size_type
size() const noexcept;
Return Value
a type to represent container sizes
exchanges the values
Synopsis
Declared in <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);
Parameters
Name |
Description |
other |
the type of an element reference |
exchanges the values
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(array_t& other);
Parameters
Name |
Description |
other |
a type for an array |
exchanges the values
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(binary_t& other);
Parameters
Name |
Description |
other |
a type for a packed binary type |
exchanges the values
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(binary_t::container_type& other);
exchanges the values
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(object_t& other);
Parameters
Name |
Description |
other |
a type for an object |
exchanges the values
Synopsis
Declared in <nlohmann/json.hpp>
void
swap(string_t& other);
Parameters
Name |
Description |
other |
a type for a string |
return the type of the JSON value (explicit)
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
value_t
type() const noexcept;
return the type as string
Synopsis
Declared in <nlohmann/json.hpp>
[[__returns_nonnull__]]
char const*
type_name() const noexcept;
unflatten a previously flattened JSON value
Synopsis
Declared in <nlohmann/json.hpp>
basic_json
unflatten() const;
Return Value
a class to store JSON values
updates a JSON object from another object, overwriting existing keys
Synopsis
Declared in <nlohmann/json.hpp>
void
update(
const_reference j,
bool merge_objects = false);
Parameters
Name |
Description |
j |
the type of an element const reference |
updates a JSON object from another object, overwriting existing keys
Synopsis
Declared in <nlohmann/json.hpp>
void
update(
const_iterator first,
const_iterator last,
bool merge_objects = false);
Parameters
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
Synopsis
Declared in <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;
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
access specified object element with default value
Synopsis
Declared in <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
Synopsis
Declared in <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;
Parameters
Name |
Description |
ptr |
JSON Pointer, see |
access specified object element with default value
Synopsis
Declared in <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;
Synopsis
Declared in <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
Synopsis
Declared in <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;
Synopsis
Declared in <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
Synopsis
Declared in <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)
Synopsis
Declared in <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;
Description
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}
Exceptions
Name |
Thrown on |
|
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 |
Return Value
copy of the JSON value, converted to type ValueType
Template Parameters
Name |
Description |
ValueType |
non‐pointer type compatible to the JSON value, for instance |
return the type of the JSON value (implicit)
Synopsis
Declared in <nlohmann/json.hpp>
constexpr
operator value_t() const noexcept;
Return Value
The object converted to value_t
comparison: equal
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
bool
operator==(ScalarType rhs) const noexcept;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
comparison: equal
Synopsis
Declared in <nlohmann/json.hpp>
bool
operator==(const_reference rhs) const noexcept;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
comparison: not equal
Synopsis
Declared in <nlohmann/json.hpp>
bool
operator!=(const_reference rhs) const noexcept;
Return Value
true
if the objects are not equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
comparison: 3‐way
Synopsis
Declared in <nlohmann/json.hpp>
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
std::partial_ordering
operator<=>(ScalarType rhs) const noexcept;
Return Value
The relative order of the objects
Parameters
Name |
Description |
rhs |
The right operand |
comparison: 3‐way
Synopsis
Declared in <nlohmann/json.hpp>
std::partial_ordering
operator<=>(const_reference rhs) const noexcept;
Return Value
The relative order of the objects
Parameters
Name |
Description |
rhs |
The right operand |
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
array(initializer_list_t init = {});
Return Value
a class to store JSON values
Parameters
Name |
Description |
init |
helper type for initializer lists of basic_json values |
explicitly create a binary array (without subtype)
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type const& init);
Return Value
a class to store JSON values
explicitly create a binary array
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(binary_t::container_type&& init);
Return Value
a class to store JSON values
explicitly create a binary array (with subtype)
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type const& init,
binary_t::subtype_type subtype);
Return Value
a class to store JSON values
explicitly create a binary array (with subtype)
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
binary(
binary_t::container_type&& init,
binary_t::subtype_type subtype);
Return Value
a class to store JSON values
creates a diff as a JSON patch
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
diff(
basic_json const& source,
basic_json const& target,
string_t const& path = "");
Return Value
a class to store JSON values
Parameters
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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in BJData format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in BSON format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
tag_handler |
how to treat CBOR tags |
create a JSON value from an input in CBOR format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
tag_handler |
how to treat CBOR tags |
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in MessagePack format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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);
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
create a JSON value from an input in UBJSON format
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/json.hpp>
static
allocator_type
get_allocator();
Return Value
the allocator type
wrapper to access iterator member functions in range‐based for
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<const_iterator>
iterator_wrapper(const_reference ref) noexcept;
Parameters
Name |
Description |
ref |
the type of an element const reference |
wrapper to access iterator member functions in range‐based for
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
static
iteration_proxy<iterator>
iterator_wrapper(reference ref) noexcept;
Parameters
Name |
Description |
ref |
the type of an element reference |
returns version information on the library
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
meta();
Return Value
a class to store JSON values
explicitly create an object from an initializer list
Synopsis
Declared in <nlohmann/json.hpp>
[[__warn_unused_result__]]
static
basic_json
object(initializer_list_t init = {});
Return Value
a class to store JSON values
Parameters
Name |
Description |
init |
helper type for initializer lists of basic_json values |
Synopsis
Declared in <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
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
cb |
per‐element parser callback type |
deserialize from a pair of character iterators
Synopsis
Declared in <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);
Return Value
a class to store JSON values
Parameters
Name |
Description |
cb |
per‐element parser callback type |
generate SAX events
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <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
Synopsis
Declared in <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);
Parameters
Name |
Description |
j |
a class to store JSON values |
version |
how to encode BJData |
create a BJData serialization of a given JSON value
Synopsis
Declared in <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);
Parameters
Name |
Description |
j |
a class to store JSON values |
version |
how to encode BJData |
create a BJData serialization of a given JSON value
Synopsis
Declared in <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);
Parameters
Name |
Description |
j |
a class to store JSON values |
version |
how to encode BJData |
create a BSON serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_bson(basic_json const& j);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a BSON serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a BSON serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_bson(
basic_json const& j,
detail::output_adapter<char> o);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a CBOR serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_cbor(basic_json const& j);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a CBOR serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a CBOR serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_cbor(
basic_json const& j,
detail::output_adapter<char> o);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a MessagePack serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_msgpack(basic_json const& j);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a MessagePack serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<uint8_t> o);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a MessagePack serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
void
to_msgpack(
basic_json const& j,
detail::output_adapter<char> o);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a UBJSON serialization of a given JSON value
Synopsis
Declared in <nlohmann/json.hpp>
static
std::vector<uint8_t>
to_ubjson(
basic_json const& j,
bool const use_size = false,
bool const use_type = false);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a UBJSON serialization of a given JSON value
Synopsis
Declared in <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);
Parameters
Name |
Description |
j |
a class to store JSON values |
create a UBJSON serialization of a given JSON value
Synopsis
Declared in <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);
Parameters
Name |
Description |
j |
a class to store JSON values |
an internal type for a backed binary type
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
template<typename BinaryType>
class byte_container_with_subtype
: public BinaryType
Base Classes
Name |
Description |
|
Types
Member Functions
Name |
Description |
|
Default constructor |
|
Construct from |
|
Construct from |
|
|
|
|
clears the binary subtype |
|
return whether the value has a subtype |
|
sets the binary subtype |
|
return the binary subtype |
|
Equality operator |
|
Inequality operator |
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
using container_type = BinaryType;
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
using subtype_type = uint64_t;
Default constructor
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype() noexcept(noexcept(container_type()));
Construct from container_type
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type const& b) noexcept(noexcept(container_type(b)));
Parameters
Name |
Description |
b |
The object to copy construct from |
Construct from container_type
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))));
Parameters
Name |
Description |
b |
The object to move construct from |
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type const& b,
subtype_type subtype_) noexcept(noexcept(container_type(b)));
Synopsis
Declared in <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
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
void
clear_subtype() noexcept;
return whether the value has a subtype
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
constexpr
bool
has_subtype() const noexcept;
sets the binary subtype
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
void
set_subtype(subtype_type subtype_) noexcept;
return the binary subtype
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
constexpr
subtype_type
subtype() const noexcept;
Equality operator
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
bool
operator==(byte_container_with_subtype const& rhs) const;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
Inequality operator
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
bool
operator!=(byte_container_with_subtype const& rhs) const;
Return Value
true
if the objects are not equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
template<>
class byte_container_with_subtype<vector<unsigned char>>
: public vector<unsigned char>
Base Classes
Name |
Description |
|
Types
Member Functions
Name |
Description |
|
Constructors |
Equality operator |
|
Inequality operator |
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
using container_type = vector<unsigned char>;
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
using subtype_type = uint64_t;
Constructors
Synopses
Declared in <nlohmann/byte_container_with_subtype.hpp>
Default constructor
byte_container_with_subtype() noexcept(noexcept(container_type()));
Construct from container_type
byte_container_with_subtype(container_type const& b) noexcept(noexcept(container_type(b)));
Construct from container_type
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))));
byte_container_with_subtype(
container_type const& b,
subtype_type subtype_) noexcept(noexcept(container_type(b)));
byte_container_with_subtype(
container_type&& b,
subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))));
Default constructor
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype() noexcept(noexcept(container_type()));
Construct from container_type
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type const& b) noexcept(noexcept(container_type(b)));
Parameters
Name |
Description |
b |
The object to copy construct from |
Construct from container_type
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))));
Parameters
Name |
Description |
b |
The object to move construct from |
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type const& b,
subtype_type subtype_) noexcept(noexcept(container_type(b)));
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
byte_container_with_subtype(
container_type&& b,
subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))));
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
void
clear_subtype() noexcept;
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
constexpr
bool
has_subtype() const noexcept;
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
void
set_subtype(subtype_type subtype_) noexcept;
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
constexpr
subtype_type
subtype() const noexcept;
Equality operator
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
bool
operator==(byte_container_with_subtype<vector<unsigned char>> const& rhs) const;
Return Value
true
if the objects are equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
Inequality operator
Synopsis
Declared in <nlohmann/byte_container_with_subtype.hpp>
bool
operator!=(byte_container_with_subtype<vector<unsigned char>> const& rhs) const;
Return Value
true
if the objects are not equal, false
otherwise
Parameters
Name |
Description |
rhs |
The right operand |
Synopsis
Declared in <nlohmann/json.hpp>
template<typename>
class json_pointer;
JSON Pointer defines a string syntax for identifying a specific value within a JSON document
Synopsis
Declared in <nlohmann/json_fwd.hpp>
template<typename RefStringType>
class json_pointer;
Friends
Name |
Description |
|
create a new JSON pointer by appending the array‐index‐token at the end of the JSON pointer |
|
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer |
|
create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer |
|
write string representation of the JSON pointer to stream |
JSON Pointer defines a string syntax for identifying a specific value within a JSON document |
|
a class to store JSON values |
a minimal map‐like container that preserves insertion order
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<
class Key,
class T,
class IgnoredLess,
class Allocator>
struct ordered_map
: std::vector<std::pair<Key const, T>, Allocator>
Base Classes
Name |
Description |
|
Types
Member Functions
Name |
Description |
|
Constructors |
Subscript operators |
Description
ordered_map: a minimal map‐like container that preserves insertion order for use within nlohmann::basic_json<ordered_map>
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using Container = std::vector<std::pair<Key const, T>, Allocator>;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using const_iterator = Container::const_iterator;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using iterator = Container::iterator;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using key_compare = std::equal_to;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using key_type = Key;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using mapped_type = T;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<typename InputIt>
using require_input_iter = void;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using size_type = Container::size_type;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
using value_type = Container::value_type;
Constructors
Synopses
Declared in <nlohmann/ordered_map.hpp>
Default constructor
ordered_map() noexcept(noexcept(Container()));
Construct from Allocator
explicit
ordered_map(Allocator const& alloc) noexcept(noexcept(Container(alloc)));
ordered_map(
std::initializer_list<value_type> init,
Allocator const& alloc = Allocator());
template<class It>
ordered_map(
It first,
It last,
Allocator const& alloc = Allocator());
Default constructor
Synopsis
Declared in <nlohmann/ordered_map.hpp>
ordered_map() noexcept(noexcept(Container()));
Construct from Allocator
Synopsis
Declared in <nlohmann/ordered_map.hpp>
explicit
ordered_map(Allocator const& alloc) noexcept(noexcept(Container(alloc)));
Parameters
Name |
Description |
alloc |
The object to copy construct from |
Synopsis
Declared in <nlohmann/ordered_map.hpp>
ordered_map(
std::initializer_list<value_type> init,
Allocator const& alloc = Allocator());
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<class It>
ordered_map(
It first,
It last,
Allocator const& alloc = Allocator());
Synopses
Declared in <nlohmann/ordered_map.hpp>
T&
at(key_type const& key);
T const&
at(key_type const& key) const;
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
at(KeyType&& key) const;
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
at(KeyType&& key);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
T&
at(key_type const& key);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
T const&
at(key_type const& key) const;
Synopsis
Declared in <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;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
at(KeyType&& key);
Synopses
Declared in <nlohmann/ordered_map.hpp>
size_type
count(key_type const& key) const;
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
count(KeyType&& key) const;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
size_type
count(key_type const& key) const;
Synopsis
Declared in <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;
Synopses
Declared in <nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
emplace(
key_type const& key,
T&& t);
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);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
emplace(
key_type const& key,
T&& t);
Synopsis
Declared in <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);
Synopses
Declared in <nlohmann/ordered_map.hpp>
size_type
erase(key_type const& key);
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
size_type
erase(KeyType&& key);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
size_type
erase(key_type const& key);
Synopsis
Declared in <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);
Synopsis
Synopses
Declared in <nlohmann/ordered_map.hpp>
iterator
find(key_type const& key);
const_iterator
find(key_type const& key) const;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
iterator
find(key_type const& key);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
const_iterator
find(key_type const& key) const;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
iterator
find(KeyType&& key);
Synopses
Declared in <nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
insert(value_type const& value);
std::pair<iterator, bool>
insert(value_type&& value);
template<
typename InputIt,
typename = require_input_iter<InputIt>>
void
insert(
InputIt first,
InputIt last);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
insert(value_type const& value);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
std::pair<iterator, bool>
insert(value_type&& value);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<
typename InputIt,
typename = require_input_iter<InputIt>>
void
insert(
InputIt first,
InputIt last);
Subscript operators
Synopses
Declared in <nlohmann/ordered_map.hpp>
T&
operator[](key_type const& key);
T const&
operator[](key_type const& key) const;
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T const&
operator[](KeyType&& key) const;
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
operator[](KeyType&& key);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
T&
operator[](key_type const& key);
Synopsis
Declared in <nlohmann/ordered_map.hpp>
T const&
operator[](key_type const& key) const;
Synopsis
Declared in <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;
Synopsis
Declared in <nlohmann/ordered_map.hpp>
template<class KeyType>
requires detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value
T&
operator[](KeyType&& key);
Synopses
Declared in <nlohmann/json.hpp>
[[__nonnull__]]
nlohmann::json
Unnamed function(
char const* s,
std::size_t n);
[[__nonnull__]]
nlohmann::json::json_pointer
Unnamed function(
char const* s,
std::size_t n);
Synopsis
Declared in <nlohmann/json.hpp>
[[__nonnull__]]
nlohmann::json
Unnamed function(
char const* s,
std::size_t n);
Synopsis
Declared in <nlohmann/json.hpp>
[[__nonnull__]]
nlohmann::json::json_pointer
Unnamed function(
char const* s,
std::size_t n);
Right shift operators
Synopses
Declared in <nlohmann/json.hpp>
deserialize from stream
std::istream&
operator>>(
std::istream& i,
basic_json& j);
deserialize from stream
std::istream&
operator>>(
std::istream& i,
basic_json& j);
serialize to stream
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
serialize to stream
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
deserialize from stream
Synopsis
Declared in <nlohmann/json.hpp>
std::istream&
operator>>(
std::istream& i,
basic_json& j);
Parameters
Name |
Description |
i |
The left operand |
j |
The right operand |
deserialize from stream
Synopsis
Declared in <nlohmann/json.hpp>
std::istream&
operator>>(
std::istream& i,
basic_json& j);
Parameters
Name |
Description |
i |
The left operand |
j |
The right operand |
serialize to stream
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
Parameters
Name |
Description |
j |
The left operand |
o |
The right operand |
serialize to stream
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
std::ostream&
operator>>(
basic_json const& j,
std::ostream& o);
Parameters
Name |
Description |
j |
The left operand |
o |
The right operand |
exchanges the values
Synopses
Declared in <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);
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);
exchanges the values
Synopsis
Declared in <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);
Parameters
Name |
Description |
left |
the type of an element reference |
right |
the type of an element reference |
exchanges the values
Synopsis
Declared in <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);
Parameters
Name |
Description |
left |
the type of an element reference |
right |
the type of an element reference |
user‐defined to_string function for JSON values
Synopsis
Declared in <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);
Parameters
Name |
Description |
j |
a class to store JSON values |
Left shift operators
Synopses
Declared in <nlohmann/json.hpp>
deserialize from stream
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
serialize to stream
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
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);
serialize to stream
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
deserialize from stream
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
Parameters
Name |
Description |
j |
The left operand |
i |
The right operand |
serialize to stream
Synopsis
Declared in <nlohmann/json.hpp>
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
Return Value
Reference to the current output stream
Parameters
Name |
Description |
o |
An output stream |
j |
The object to output |
deserialize from stream
Synopsis
Declared in <nlohmann/json.hpp>
[[__deprecated__]]
std::istream&
operator<<(
basic_json& j,
std::istream& i);
Parameters
Name |
Description |
j |
The left operand |
i |
The right operand |
serialize to stream
Synopsis
Declared in <nlohmann/json.hpp>
std::ostream&
operator<<(
std::ostream& o,
basic_json const& j);
Return Value
Reference to the current output stream
Parameters
Name |
Description |
o |
An output stream |
j |
The object to output |
Synopsis
Declared in <nlohmann/json.hpp>
using nlohmann::literals::json_literals::;
Introduced Symbols
Name |
Synopsis
Declared in <nlohmann/json.hpp>
using nlohmann::literals::json_literals::;
Introduced Symbols
Name |
Created with MrDocs