Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
json.hpp File Reference
#include <algorithm>
#include <cassert>
#include <ciso646>
#include <cstddef>
#include <functional>
#include <initializer_list>
#include <iosfwd>
#include <iterator>
#include <numeric>
#include <string>
#include <utility>
#include <cstdint>
#include <map>
#include <memory>
#include <vector>
#include <limits>
#include <type_traits>
#include <exception>
#include <stdexcept>
#include <array>
#include <forward_list>
#include <tuple>
#include <valarray>
#include <cstring>
#include <ios>
#include <istream>
#include <clocale>
#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <ostream>
#include <cstdio>
Include dependency graph for json.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nlohmann::adl_serializer< typename, typename >
 default JSONSerializer template argument More...
 
struct  nlohmann::adl_serializer< typename, typename >
 default JSONSerializer template argument More...
 
class  nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >
 a class to store JSON values More...
 
class  nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >
 a class to store JSON values More...
 
class  nlohmann::detail::binary_reader< BasicJsonType >
 deserialization of CBOR and MessagePack values More...
 
class  nlohmann::detail::binary_writer< BasicJsonType, CharType >
 serialization to CBOR and MessagePack values More...
 
struct  nlohmann::detail::dtoa_impl::boundaries
 
struct  nlohmann::detail::dtoa_impl::cached_power
 
struct  nlohmann::detail::conjunction<... >
 
struct  nlohmann::detail::conjunction< B1 >
 
struct  nlohmann::detail::conjunction< B1, Bn... >
 
struct  nlohmann::detail::dtoa_impl::diyfp
 
class  nlohmann::detail::exception
 general exception of the basic_json class More...
 
struct  nlohmann::detail::external_constructor< value_t >
 
struct  nlohmann::detail::external_constructor< value_t::array >
 
struct  nlohmann::detail::external_constructor< value_t::boolean >
 
struct  nlohmann::detail::external_constructor< value_t::number_float >
 
struct  nlohmann::detail::external_constructor< value_t::number_integer >
 
struct  nlohmann::detail::external_constructor< value_t::number_unsigned >
 
struct  nlohmann::detail::external_constructor< value_t::object >
 
struct  nlohmann::detail::external_constructor< value_t::string >
 
struct  nlohmann::detail::from_json_fn
 
struct  nlohmann::detail::has_from_json< BasicJsonType, T >
 
struct  nlohmann::detail::has_non_default_from_json< BasicJsonType, T >
 
struct  nlohmann::detail::has_to_json< BasicJsonType, T >
 
struct  std::hash< nlohmann::json >
 hash value for JSON objects More...
 
struct  nlohmann::detail::index_sequence< Ints >
 
class  nlohmann::detail::input_adapter
 
struct  nlohmann::detail::input_adapter_protocol
 abstract input adapter interface More...
 
class  nlohmann::detail::input_buffer_adapter
 input adapter for buffer input More...
 
class  nlohmann::detail::input_stream_adapter
 
struct  nlohmann::detail::internal_iterator< BasicJsonType >
 an iterator value More...
 
class  nlohmann::detail::invalid_iterator
 exception indicating errors with iterators More...
 
struct  nlohmann::detail::is_basic_json< typename >
 
struct  nlohmann::detail::is_basic_json< NLOHMANN_BASIC_JSON_TPL >
 
struct  nlohmann::detail::is_basic_json_nested_type< BasicJsonType, T >
 
struct  nlohmann::detail::is_compatible_array_type< BasicJsonType, CompatibleArrayType >
 
struct  nlohmann::detail::is_compatible_complete_type< BasicJsonType, CompatibleCompleteType >
 
struct  nlohmann::detail::is_compatible_integer_type< RealIntegerType, CompatibleNumberIntegerType >
 
struct  nlohmann::detail::is_compatible_integer_type_impl< bool, typename, typename >
 
struct  nlohmann::detail::is_compatible_integer_type_impl< true, RealIntegerType, CompatibleNumberIntegerType >
 
struct  nlohmann::detail::is_compatible_object_type< BasicJsonType, CompatibleObjectType >
 
struct  nlohmann::detail::is_compatible_object_type_impl< B, RealType, CompatibleObjectType >
 
struct  nlohmann::detail::is_compatible_object_type_impl< true, RealType, CompatibleObjectType >
 
struct  nlohmann::detail::is_compatible_type< BasicJsonType, CompatibleType >
 
struct  nlohmann::detail::is_complete_type< T, typename >
 
struct  nlohmann::detail::is_complete_type< T, decltype(void(sizeof(T)))>
 
class  nlohmann::detail::iter_impl< BasicJsonType >
 a template for a bidirectional iterator for the basic_json class More...
 
class  nlohmann::detail::iteration_proxy< IteratorType >
 proxy class for the items() function More...
 
class  nlohmann::detail::iteration_proxy< IteratorType >
 proxy class for the items() function More...
 
class  nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal
 helper class for iteration More...
 
class  nlohmann::json_pointer< BasicJsonType >
 JSON Pointer. More...
 
class  nlohmann::json_pointer< BasicJsonType >
 JSON Pointer. More...
 
class  nlohmann::detail::json_ref< BasicJsonType >
 
class  nlohmann::detail::json_reverse_iterator< Base >
 a template for a reverse iterator class More...
 
union  nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value
 a JSON value More...
 
struct  std::less< ::nlohmann::detail::value_t >
 
class  nlohmann::detail::lexer< BasicJsonType >
 lexical analysis More...
 
struct  nlohmann::detail::make_index_sequence< N >
 
struct  nlohmann::detail::make_index_sequence< 0 >
 
struct  nlohmann::detail::make_index_sequence< 1 >
 
struct  nlohmann::detail::merge_and_renumber< Sequence1, Sequence2 >
 
struct  nlohmann::detail::merge_and_renumber< index_sequence< I1... >, index_sequence< I2... > >
 
struct  nlohmann::detail::negation< B >
 
class  nlohmann::detail::other_error
 exception indicating other library errors More...
 
class  nlohmann::detail::out_of_range
 exception indicating access out of the defined range More...
 
class  nlohmann::detail::output_adapter< CharType, StringType >
 
struct  nlohmann::detail::output_adapter_protocol< CharType >
 abstract output adapter interface More...
 
class  nlohmann::detail::output_stream_adapter< CharType >
 output adapter for output streams More...
 
class  nlohmann::detail::output_string_adapter< CharType, StringType >
 output adapter for basic_string More...
 
class  nlohmann::detail::output_vector_adapter< CharType >
 output adapter for byte vectors More...
 
class  nlohmann::detail::parse_error
 exception indicating a parse error More...
 
class  nlohmann::detail::parser< BasicJsonType >
 syntax analysis More...
 
class  nlohmann::detail::primitive_iterator_t
 
struct  nlohmann::detail::priority_tag< N >
 
struct  nlohmann::detail::priority_tag< 0 >
 
class  nlohmann::detail::serializer< BasicJsonType >
 
struct  nlohmann::detail::static_const< T >
 
struct  nlohmann::detail::to_json_fn
 
class  nlohmann::detail::type_error
 exception indicating executing a member function with a wrong type More...
 

Namespaces

 nlohmann
 namespace for Niels Lohmann
 
 nlohmann::detail
 detail namespace with internal helper functions
 
 nlohmann::detail::dtoa_impl
 implements the Grisu2 algorithm for binary to decimal floating-point conversion.
 
 std
 

Macros

#define JSON_CATCH(exception)   if(false)
 
#define JSON_DEPRECATED
 
#define JSON_LIKELY(x)   x
 
#define JSON_THROW(exception)   std::abort()
 
#define JSON_TRY   if(true)
 
#define JSON_UNLIKELY(x)   x
 
#define NLOHMANN_BASIC_JSON_TPL
 
#define NLOHMANN_BASIC_JSON_TPL_DECLARATION
 
#define NLOHMANN_JSON_FWD_HPP
 
#define NLOHMANN_JSON_HAS_HELPER(type)
 Helper to determine whether there's a key_type for T. More...
 
#define NLOHMANN_JSON_VERSION_MAJOR   3
 
#define NLOHMANN_JSON_VERSION_MINOR   1
 
#define NLOHMANN_JSON_VERSION_PATCH   2
 

Typedefs

template<bool B, typename T = void>
using nlohmann::detail::enable_if_t = typename std::enable_if< B, T >::type
 
template<typename... Ts>
using nlohmann::detail::index_sequence_for = make_index_sequence< sizeof...(Ts)>
 
using nlohmann::detail::input_adapter_t = std::shared_ptr< input_adapter_protocol >
 a type to simplify interfaces More...
 
using nlohmann::json = basic_json<>
 default JSON class More...
 
template<typename CharType >
using nlohmann::detail::output_adapter_t = std::shared_ptr< output_adapter_protocol< CharType >>
 a type to simplify interfaces More...
 
template<typename T >
using nlohmann::detail::uncvref_t = typename std::remove_cv< typename std::remove_reference< T >::type >::type
 

Enumerations

enum  nlohmann::detail::value_t : std::uint8_t {
  nlohmann::detail::value_t::null, nlohmann::detail::value_t::object, nlohmann::detail::value_t::array, nlohmann::detail::value_t::string,
  nlohmann::detail::value_t::boolean, nlohmann::detail::value_t::number_integer, nlohmann::detail::value_t::number_unsigned, nlohmann::detail::value_t::number_float,
  nlohmann::detail::value_t::discarded
}
 the JSON type enumeration More...
 

Functions

char * nlohmann::detail::dtoa_impl::append_exponent (char *buf, int e)
 appends a decimal representation of e to buf More...
 
template<typename FloatType >
boundaries nlohmann::detail::dtoa_impl::compute_boundaries (FloatType value)
 
int nlohmann::detail::dtoa_impl::find_largest_pow10 (const uint32_t n, uint32_t &pow10)
 
char * nlohmann::detail::dtoa_impl::format_buffer (char *buf, int len, int decimal_exponent, int min_exp, int max_exp)
 prettify v = buf * 10^decimal_exponent More...
 
template<typename BasicJsonType >
void nlohmann::detail::from_json (const BasicJsonType &j, typename BasicJsonType::boolean_t &b)
 
template<typename BasicJsonType >
void nlohmann::detail::from_json (const BasicJsonType &j, typename BasicJsonType::string_t &s)
 
template<typename BasicJsonType >
void nlohmann::detail::from_json (const BasicJsonType &j, typename BasicJsonType::number_float_t &val)
 
template<typename BasicJsonType >
void nlohmann::detail::from_json (const BasicJsonType &j, typename BasicJsonType::number_unsigned_t &val)
 
template<typename BasicJsonType >
void nlohmann::detail::from_json (const BasicJsonType &j, typename BasicJsonType::number_integer_t &val)
 
template<typename BasicJsonType , typename EnumType , enable_if_t< std::is_enum< EnumType >::value, int > = 0>
void nlohmann::detail::from_json (const BasicJsonType &j, EnumType &e)
 
template<typename BasicJsonType >
void nlohmann::detail::from_json (const BasicJsonType &j, typename BasicJsonType::array_t &arr)
 
template<typename BasicJsonType , typename T , typename Allocator , enable_if_t< std::is_convertible< BasicJsonType, T >::value, int > = 0>
void nlohmann::detail::from_json (const BasicJsonType &j, std::forward_list< T, Allocator > &l)
 
template<typename BasicJsonType , typename T , enable_if_t< std::is_convertible< BasicJsonType, T >::value, int > = 0>
void nlohmann::detail::from_json (const BasicJsonType &j, std::valarray< T > &l)
 
template<typename BasicJsonType , typename CompatibleArrayType , enable_if_t< is_compatible_array_type< BasicJsonType, CompatibleArrayType >::value andnot std::is_same< typename BasicJsonType::array_t, CompatibleArrayType >::value andstd::is_constructible< BasicJsonType, typename CompatibleArrayType::value_type >::value, int > = 0>
void nlohmann::detail::from_json (const BasicJsonType &j, CompatibleArrayType &arr)
 
template<typename BasicJsonType , typename CompatibleObjectType , enable_if_t< is_compatible_object_type< BasicJsonType, CompatibleObjectType >::value, int > = 0>
void nlohmann::detail::from_json (const BasicJsonType &j, CompatibleObjectType &obj)
 
template<typename BasicJsonType , typename ArithmeticType , enable_if_t< std::is_arithmetic< ArithmeticType >::value andnot std::is_same< ArithmeticType, typename BasicJsonType::number_unsigned_t >::value andnot std::is_same< ArithmeticType, typename BasicJsonType::number_integer_t >::value andnot std::is_same< ArithmeticType, typename BasicJsonType::number_float_t >::value andnot std::is_same< ArithmeticType, typename BasicJsonType::boolean_t >::value, int > = 0>
void nlohmann::detail::from_json (const BasicJsonType &j, ArithmeticType &val)
 
template<typename BasicJsonType , typename A1 , typename A2 >
void nlohmann::detail::from_json (const BasicJsonType &j, std::pair< A1, A2 > &p)
 
template<typename BasicJsonType , typename... Args>
void nlohmann::detail::from_json (const BasicJsonType &j, std::tuple< Args... > &t)
 
template<typename BasicJsonType , typename CompatibleArrayType >
void nlohmann::detail::from_json_array_impl (const BasicJsonType &j, CompatibleArrayType &arr, priority_tag< 0 >)
 
template<typename BasicJsonType , typename CompatibleArrayType >
auto nlohmann::detail::from_json_array_impl (const BasicJsonType &j, CompatibleArrayType &arr, priority_tag< 1 >) -> decltype(arr.reserve(std::declval< typename CompatibleArrayType::size_type >()), void())
 
template<typename BasicJsonType , typename T , std::size_t N>
void nlohmann::detail::from_json_array_impl (const BasicJsonType &j, std::array< T, N > &arr, priority_tag< 2 >)
 
template<typename BasicJsonType , typename Tuple , std::size_t... Idx>
void nlohmann::detail::from_json_tuple_impl (const BasicJsonType &j, Tuple &t, index_sequence< Idx... >)
 
template<typename BasicJsonType , typename ArithmeticType , enable_if_t< std::is_arithmetic< ArithmeticType >::value andnot std::is_same< ArithmeticType, typename BasicJsonType::boolean_t >::value, int > = 0>
void nlohmann::detail::get_arithmetic_value (const BasicJsonType &j, ArithmeticType &val)
 
cached_power nlohmann::detail::dtoa_impl::get_cached_power_for_binary_exponent (int e)
 
void nlohmann::detail::dtoa_impl::grisu2 (char *buf, int &len, int &decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus)
 
template<typename FloatType >
void nlohmann::detail::dtoa_impl::grisu2 (char *buf, int &len, int &decimal_exponent, FloatType value)
 
void nlohmann::detail::dtoa_impl::grisu2_digit_gen (char *buffer, int &length, int &decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus)
 
void nlohmann::detail::dtoa_impl::grisu2_round (char *buf, int len, uint64_t dist, uint64_t delta, uint64_t rest, uint64_t ten_k)
 
 nlohmann::detail::NLOHMANN_JSON_HAS_HELPER (mapped_type)
 
 nlohmann::detail::NLOHMANN_JSON_HAS_HELPER (key_type)
 
 nlohmann::detail::NLOHMANN_JSON_HAS_HELPER (value_type)
 
 nlohmann::detail::NLOHMANN_JSON_HAS_HELPER (iterator)
 
nlohmann::json operator""_json (const char *s, std::size_t n)
 user-defined string literal for JSON values More...
 
nlohmann::json::json_pointer operator""_json_pointer (const char *s, std::size_t n)
 user-defined string literal for JSON pointer More...
 
bool nlohmann::detail::operator< (const value_t lhs, const value_t rhs) noexcept
 comparison operator for JSON types More...
 
template<typename Target , typename Source >
Target nlohmann::detail::dtoa_impl::reinterpret_bits (const Source source)
 
template<>
void std::swap (nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value andis_nothrow_move_assignable< nlohmann::json >::value)
 exchanges the values of two JSON objects More...
 
template<typename FloatType >
char * nlohmann::detail::to_chars (char *first, char *last, FloatType value)
 generates a decimal representation of the floating-point number value in [first, last). More...
 
template<typename BasicJsonType , typename T , enable_if_t< std::is_same< T, typename BasicJsonType::boolean_t >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, T b) noexcept
 
template<typename BasicJsonType , typename CompatibleString , enable_if_t< std::is_constructible< typename BasicJsonType::string_t, CompatibleString >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, const CompatibleString &s)
 
template<typename BasicJsonType >
void nlohmann::detail::to_json (BasicJsonType &j, typename BasicJsonType::string_t &&s)
 
template<typename BasicJsonType , typename FloatType , enable_if_t< std::is_floating_point< FloatType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, FloatType val) noexcept
 
template<typename BasicJsonType , typename CompatibleNumberUnsignedType , enable_if_t< is_compatible_integer_type< typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, CompatibleNumberUnsignedType val) noexcept
 
template<typename BasicJsonType , typename CompatibleNumberIntegerType , enable_if_t< is_compatible_integer_type< typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, CompatibleNumberIntegerType val) noexcept
 
template<typename BasicJsonType , typename EnumType , enable_if_t< std::is_enum< EnumType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, EnumType e) noexcept
 
template<typename BasicJsonType >
void nlohmann::detail::to_json (BasicJsonType &j, const std::vector< bool > &e)
 
template<typename BasicJsonType , typename CompatibleArrayType , enable_if_t< is_compatible_array_type< BasicJsonType, CompatibleArrayType >::value orstd::is_same< typename BasicJsonType::array_t, CompatibleArrayType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, const CompatibleArrayType &arr)
 
template<typename BasicJsonType , typename T , enable_if_t< std::is_convertible< T, BasicJsonType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, std::valarray< T > arr)
 
template<typename BasicJsonType >
void nlohmann::detail::to_json (BasicJsonType &j, typename BasicJsonType::array_t &&arr)
 
template<typename BasicJsonType , typename CompatibleObjectType , enable_if_t< is_compatible_object_type< BasicJsonType, CompatibleObjectType >::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, const CompatibleObjectType &obj)
 
template<typename BasicJsonType >
void nlohmann::detail::to_json (BasicJsonType &j, typename BasicJsonType::object_t &&obj)
 
template<typename BasicJsonType , typename T , std::size_t N, enable_if_t< not std::is_constructible< typename BasicJsonType::string_t, T(&)[N]>::value, int > = 0>
void nlohmann::detail::to_json (BasicJsonType &j, T(&arr)[N])
 
template<typename BasicJsonType , typename... Args>
void nlohmann::detail::to_json (BasicJsonType &j, const std::pair< Args... > &p)
 
template<typename BasicJsonType , typename... Args>
void nlohmann::detail::to_json (BasicJsonType &j, const std::tuple< Args... > &t)
 
template<typename BasicJsonType , typename Tuple , std::size_t... Idx>
void nlohmann::detail::to_json_tuple_impl (BasicJsonType &j, const Tuple &t, index_sequence< Idx... >)
 

Variables

constexpr int nlohmann::detail::dtoa_impl::kAlpha = -60
 
constexpr int nlohmann::detail::dtoa_impl::kGamma = -32
 

Macro Definition Documentation

#define JSON_CATCH (   exception)    if(false)

Definition at line 160 of file json.hpp.

#define JSON_DEPRECATED

Definition at line 149 of file json.hpp.

#define JSON_LIKELY (   x)    x

Definition at line 182 of file json.hpp.

#define JSON_THROW (   exception)    std::abort()

Definition at line 158 of file json.hpp.

#define JSON_TRY   if(true)

Definition at line 159 of file json.hpp.

#define JSON_UNLIKELY (   x)    x

Definition at line 183 of file json.hpp.

#define NLOHMANN_BASIC_JSON_TPL
Value:
basic_json<ObjectType, ArrayType, StringType, BooleanType, \
NumberIntegerType, NumberUnsignedType, NumberFloatType, \
AllocatorType, JSONSerializer>

Definition at line 205 of file json.hpp.

#define NLOHMANN_BASIC_JSON_TPL_DECLARATION
Value:
template<template<typename, typename, typename...> class ObjectType, \
template<typename, typename...> class ArrayType, \
class StringType, class BooleanType, class NumberIntegerType, \
class NumberUnsignedType, class NumberFloatType, \
template<typename> class AllocatorType, \
template<typename, typename = void> class JSONSerializer>

Definition at line 197 of file json.hpp.

#define NLOHMANN_JSON_FWD_HPP

Definition at line 50 of file json.hpp.

#define NLOHMANN_JSON_HAS_HELPER (   type)
Value:
template<typename T> struct has_##type { \
private: \
template<typename U, typename = typename U::type> \
static int detect(U &&); \
static void detect(...); \
public: \
static constexpr bool value = \
std::is_integral<decltype(detect(std::declval<T>()))>::value; \
}

Helper to determine whether there's a key_type for T.

This helper is used to tell associative containers apart from other containers such as sequence containers. For instance, std::map passes the test as it contains a mapped_type, whereas std::vector fails the test.

See also
http://stackoverflow.com/a/7728728/266378
Since
version 1.0.0, overworked in version 2.0.6

Definition at line 220 of file json.hpp.

#define NLOHMANN_JSON_VERSION_MAJOR   3

Definition at line 32 of file json.hpp.

#define NLOHMANN_JSON_VERSION_MINOR   1

Definition at line 33 of file json.hpp.

#define NLOHMANN_JSON_VERSION_PATCH   2

Definition at line 34 of file json.hpp.

Function Documentation

nlohmann::json operator""_json ( const char *  s,
std::size_t  n 
)
inline

user-defined string literal for JSON values

This operator implements a user-defined string literal for JSON objects. It can be used by adding "_json" to a string literal and returns a JSON object if no parse error occurred.

Parameters
[in]sa string representation of a JSON object
[in]nthe length of string s
Returns
a JSON object
Since
version 1.0.0

Definition at line 17252 of file json.hpp.

nlohmann::json::json_pointer operator""_json_pointer ( const char *  s,
std::size_t  n 
)
inline

user-defined string literal for JSON pointer

This operator implements a user-defined string literal for JSON Pointers. It can be used by adding "_json_pointer" to a string literal and returns a JSON pointer object if no parse error occurred.

Parameters
[in]sa string representation of a JSON Pointer
[in]nthe length of string s
Returns
a JSON pointer object
Since
version 2.0.0

Definition at line 17270 of file json.hpp.



json_transport
Author(s): Paul Bovbel
autogenerated on Thu Jun 13 2019 19:12:24