|
| static basic_json | array (std::initializer_list< basic_json > init=std::initializer_list< basic_json >()) |
| | explicitly create an array from an initializer list More...
|
| |
| static basic_json | object (std::initializer_list< basic_json > init=std::initializer_list< basic_json >()) |
| | explicitly create an object from an initializer list More...
|
| |
| | basic_json (const value_t value_type) |
| | create an empty value with a given type More...
|
| |
| | basic_json ()=default |
| | create a null object (implicitly) More...
|
| |
| | basic_json (std::nullptr_t) noexcept |
| | create a null object (explicitly) More...
|
| |
| | basic_json (const object_t &val) |
| | create an object (explicit) More...
|
| |
| template<class CompatibleObjectType , typename std::enable_if< std::is_constructible< typename object_t::key_type, typename CompatibleObjectType::key_type >::value and std::is_constructible< basic_json, typename CompatibleObjectType::mapped_type >::value, int >::type = 0> |
| | basic_json (const CompatibleObjectType &val) |
| | create an object (implicit) More...
|
| |
| | basic_json (const array_t &val) |
| | create an array (explicit) More...
|
| |
| template<class CompatibleArrayType , typename std::enable_if< not std::is_same< CompatibleArrayType, typename basic_json_t::iterator >::value and not std::is_same< CompatibleArrayType, typename basic_json_t::const_iterator >::value and not std::is_same< CompatibleArrayType, typename basic_json_t::reverse_iterator >::value and not std::is_same< CompatibleArrayType, typename basic_json_t::const_reverse_iterator >::value and not std::is_same< CompatibleArrayType, typename array_t::iterator >::value and not std::is_same< CompatibleArrayType, typename array_t::const_iterator >::value and std::is_constructible< basic_json, typename CompatibleArrayType::value_type >::value, int >::type = 0> |
| | basic_json (const CompatibleArrayType &val) |
| | create an array (implicit) More...
|
| |
| | basic_json (const string_t &val) |
| | create a string (explicit) More...
|
| |
| | basic_json (const typename string_t::value_type *val) |
| | create a string (explicit) More...
|
| |
| template<class CompatibleStringType , typename std::enable_if< std::is_constructible< string_t, CompatibleStringType >::value, int >::type = 0> |
| | basic_json (const CompatibleStringType &val) |
| | create a string (implicit) More...
|
| |
| | basic_json (boolean_t val) noexcept |
| | create a boolean (explicit) More...
|
| |
| template<typename T , typename std::enable_if< not(std::is_same< T, int >::value) and std::is_same< T, number_integer_t >::value , int >::type = 0> |
| | basic_json (const number_integer_t val) noexcept |
| | create an integer number (explicit) More...
|
| |
| | basic_json (const int val) noexcept |
| | create an integer number from an enum type (explicit) More...
|
| |
| template<typename CompatibleNumberIntegerType , typename std::enable_if< std::is_constructible< number_integer_t, CompatibleNumberIntegerType >::value and std::numeric_limits< CompatibleNumberIntegerType >::is_integer and std::numeric_limits< CompatibleNumberIntegerType >::is_signed, CompatibleNumberIntegerType >::type = 0> |
| | basic_json (const CompatibleNumberIntegerType val) noexcept |
| | create an integer number (implicit) More...
|
| |
| template<typename T , typename std::enable_if< not(std::is_same< T, int >::value) and std::is_same< T, number_unsigned_t >::value , int >::type = 0> |
| | basic_json (const number_unsigned_t val) noexcept |
| | create an unsigned integer number (explicit) More...
|
| |
| template<typename CompatibleNumberUnsignedType , typename std::enable_if< std::is_constructible< number_unsigned_t, CompatibleNumberUnsignedType >::value and std::numeric_limits< CompatibleNumberUnsignedType >::is_integer and !std::numeric_limits< CompatibleNumberUnsignedType >::is_signed, CompatibleNumberUnsignedType >::type = 0> |
| | basic_json (const CompatibleNumberUnsignedType val) noexcept |
| | create an unsigned number (implicit) More...
|
| |
| | basic_json (const number_float_t val) noexcept |
| | create a floating-point number (explicit) More...
|
| |
| template<typename CompatibleNumberFloatType , typename = typename std::enable_if< std::is_constructible<number_float_t, CompatibleNumberFloatType>::value and std::is_floating_point<CompatibleNumberFloatType>::value>::type> |
| | basic_json (const CompatibleNumberFloatType val) noexcept |
| | create an floating-point number (implicit) More...
|
| |
| | basic_json (std::initializer_list< basic_json > init, bool type_deduction=true, value_t manual_type=value_t::array) |
| | create a container (array or object) from an initializer list More...
|
| |
| | basic_json (size_type cnt, const basic_json &val) |
| | construct an array with count copies of given value More...
|
| |
| template<class InputIT , typename std::enable_if< std::is_same< InputIT, typename basic_json_t::iterator >::value or std::is_same< InputIT, typename basic_json_t::const_iterator >::value , int >::type = 0> |
| | basic_json (InputIT first, InputIT last) |
| | construct a JSON container given an iterator range More...
|
| |
| | basic_json (std::istream &i, parser_callback_t cb=nullptr) |
| | construct a JSON value given an input stream More...
|
| |
| | basic_json (const basic_json &other) |
| | copy constructor More...
|
| |
| | basic_json (basic_json &&other) noexcept |
| | move constructor More...
|
| |
| reference & | operator= (basic_json other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value ) |
| | copy assignment More...
|
| |
| | ~basic_json () |
| | destructor More...
|
| |
|
| template<typename ValueType , typename std::enable_if< not std::is_pointer< ValueType >::value , int >::type = 0> |
| ValueType | get () const |
| | get a value (explicit) More...
|
| |
| template<typename PointerType , typename std::enable_if< std::is_pointer< PointerType >::value , int >::type = 0> |
| PointerType | get () noexcept |
| | get a pointer value (explicit) More...
|
| |
| template<typename PointerType , typename std::enable_if< std::is_pointer< PointerType >::value , int >::type = 0> |
| constexpr const PointerType | get () const noexcept |
| | get a pointer value (explicit) More...
|
| |
| template<typename PointerType , typename std::enable_if< std::is_pointer< PointerType >::value , int >::type = 0> |
| PointerType | get_ptr () noexcept |
| | get a pointer value (implicit) More...
|
| |
| template<typename PointerType , typename std::enable_if< std::is_pointer< PointerType >::value and std::is_const< typename std::remove_pointer< PointerType >::type >::value , int >::type = 0> |
| constexpr const PointerType | get_ptr () const noexcept |
| | get a pointer value (implicit) More...
|
| |
| template<typename ReferenceType , typename std::enable_if< std::is_reference< ReferenceType >::value , int >::type = 0> |
| ReferenceType | get_ref () |
| | get a reference value (implicit) More...
|
| |
| template<typename ReferenceType , typename std::enable_if< std::is_reference< ReferenceType >::value and std::is_const< typename std::remove_reference< ReferenceType >::type >::value , int >::type = 0> |
| ReferenceType | get_ref () const |
| | get a reference value (implicit) More...
|
| |
| template<typename ValueType , typename std::enable_if< not std::is_pointer< ValueType >::value and not std::is_same< ValueType, typename string_t::value_type >::value and not std::is_same< ValueType, std::initializer_list< typename string_t::value_type >>::value , int >::type = 0> |
| | operator ValueType () const |
| | get a value (implicit) More...
|
| |
|
| reference | at (size_type idx) |
| | access specified array element with bounds checking More...
|
| |
| const_reference | at (size_type idx) const |
| | access specified array element with bounds checking More...
|
| |
| reference | at (const typename object_t::key_type &key) |
| | access specified object element with bounds checking More...
|
| |
| const_reference | at (const typename object_t::key_type &key) const |
| | access specified object element with bounds checking More...
|
| |
| reference | operator[] (size_type idx) |
| | access specified array element More...
|
| |
| const_reference | operator[] (size_type idx) const |
| | access specified array element More...
|
| |
| reference | operator[] (const typename object_t::key_type &key) |
| | access specified object element More...
|
| |
| const_reference | operator[] (const typename object_t::key_type &key) const |
| | read-only access specified object element More...
|
| |
| template<typename T , std::size_t n> |
| reference | operator[] (T *(&key)[n]) |
| | access specified object element More...
|
| |
| template<typename T , std::size_t n> |
| const_reference | operator[] (T *(&key)[n]) const |
| | read-only access specified object element More...
|
| |
| template<typename T > |
| reference | operator[] (T *key) |
| | access specified object element More...
|
| |
| template<typename T > |
| const_reference | operator[] (T *key) const |
| | read-only access specified object element More...
|
| |
| template<class ValueType , typename std::enable_if< std::is_convertible< basic_json_t, ValueType >::value , int >::type = 0> |
| ValueType | value (const typename object_t::key_type &key, ValueType default_value) const |
| | access specified object element with default value More...
|
| |
| string_t | value (const typename object_t::key_type &key, const char *default_value) const |
| | overload for a default value of type const char* More...
|
| |
| reference | front () |
| | access the first element More...
|
| |
| const_reference | front () const |
| | access the first element More...
|
| |
| reference | back () |
| | access the last element More...
|
| |
| const_reference | back () const |
| | access the last element More...
|
| |
| template<class InteratorType , typename std::enable_if< std::is_same< InteratorType, typename basic_json_t::iterator >::value or std::is_same< InteratorType, typename basic_json_t::const_iterator >::value , int >::type = 0> |
| InteratorType | erase (InteratorType pos) |
| | remove element given an iterator More...
|
| |
| template<class InteratorType , typename std::enable_if< std::is_same< InteratorType, typename basic_json_t::iterator >::value or std::is_same< InteratorType, typename basic_json_t::const_iterator >::value , int >::type = 0> |
| InteratorType | erase (InteratorType first, InteratorType last) |
| | remove elements given an iterator range More...
|
| |
| size_type | erase (const typename object_t::key_type &key) |
| | remove element from a JSON object given a key More...
|
| |
| void | erase (const size_type idx) |
| | remove element from a JSON array given an index More...
|
| |
|
| bool | operator< (const value_t lhs, const value_t rhs) noexcept |
| | comparison operator for JSON types More...
|
| |
| bool | operator== (const_reference lhs, const_reference rhs) noexcept |
| | comparison: equal More...
|
| |
| bool | operator== (const_reference v, std::nullptr_t) noexcept |
| | comparison: equal More...
|
| |
| bool | operator== (std::nullptr_t, const_reference v) noexcept |
| | comparison: equal More...
|
| |
| bool | operator!= (const_reference lhs, const_reference rhs) noexcept |
| | comparison: not equal More...
|
| |
| bool | operator!= (const_reference v, std::nullptr_t) noexcept |
| | comparison: not equal More...
|
| |
| bool | operator!= (std::nullptr_t, const_reference v) noexcept |
| | comparison: not equal More...
|
| |
| bool | operator< (const_reference lhs, const_reference rhs) noexcept |
| | comparison: less than More...
|
| |
| bool | operator<= (const_reference lhs, const_reference rhs) noexcept |
| | comparison: less than or equal More...
|
| |
| bool | operator> (const_reference lhs, const_reference rhs) noexcept |
| | comparison: greater than More...
|
| |
| bool | operator>= (const_reference lhs, const_reference rhs) noexcept |
| | comparison: greater than or equal More...
|
| |
template<template< typename U, typename V, typename...Args > class ObjectType = std::map, template< typename U, typename...Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator>
class nlohmann::basic_json
- Template Parameters
-
| ObjectType | type for JSON objects (std::map by default; will be used in object_t) |
| ArrayType | type for JSON arrays (std::vector by default; will be used in array_t) |
| StringType | type for JSON strings and object keys (std::string by default; will be used in string_t) |
| BooleanType | type for JSON booleans (bool by default; will be used in boolean_t) |
| NumberIntegerType | type for JSON integer numbers (int64_t by default; will be used in number_integer_t) |
| NumberUnsignedType | type for JSON unsigned integer numbers (uint64_t by default; will be used in number_unsigned_t) |
| NumberFloatType | type for JSON floating-point numbers (double by default; will be used in number_float_t) |
| AllocatorType | type of the allocator to use (std::allocator by default) |
- Requirements
- The class satisfies the following concept requirements:
- Basic
- Layout
- StandardLayoutType: JSON values have standard layout: All non-static data members are private and standard layout types, the class has no virtual functions or (virtual) base classes.
- Library-wide
- Container
- Container: JSON values can be used like STL containers and provide iterator access.
- ReversibleContainer; JSON values can be used like STL containers and provide reverse iterator access.
- See also
- RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format
- Since
- version 1.0.0
Definition at line 187 of file json.hpp.