JSON for Modern C++ 2.1.1

allocator_type
array
array_t
at
at
at
at
at
at
back
back
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
begin
begin
boolean_t
cbegin
cend
clear
const_iterator
const_pointer
const_reference
const_reverse_iterator
count
crbegin
crend
detail::external_constructor
diff
difference_type
dump
emplace
emplace_back
empty
end
end
erase
erase
erase
erase
exception
find
find
flatten
from_cbor
from_msgpack
front
front
get
get
get
get
get
get_allocator
get_ptr
get_ptr
get_ref
get_ref
insert
insert
insert
insert
insert
insert
invalid_iterator
is_array
is_boolean
is_discarded
is_null
is_number
is_number_float
is_number_integer
is_number_unsigned
is_object
is_primitive
is_string
is_structured
iterator
iterator_wrapper
iterator_wrapper
json_serializer
max_size
meta
number_float_t
number_integer_t
number_unsigned_t
object
object_t
operator value_t
operator ValueType
operator!=
operator!=
operator!=
operator+=
operator+=
operator+=
operator+=
operator<
operator<
operator<
operator<<
operator<<
operator<=
operator<=
operator<=
operator=
operator==
operator==
operator==
operator>
operator>
operator>
operator>=
operator>=
operator>=
operator>>
operator>>
operator[]
operator[]
operator[]
operator[]
operator[]
operator[]
operator[]
operator[]
operator[]
operator[]
other_error
out_of_range
parse
parse
parse
parse
parse
parse
parse_error
parse_event_t
parser_callback_t
patch
pointer
push_back
push_back
push_back
push_back
rbegin
rbegin
reference
rend
rend
reverse_iterator
size
size_type
string_t
swap
swap
swap
swap
to_cbor
to_msgpack
type
type_error
type_name
unflatten
value
value
value
value
value_t
value_type
~basic_json
| ## ◆ operator>> [2/2] 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, template< typename T, typename SFINAE=void > class JSONSerializer = adl_serializer>
std::istream& operator>> | ( | std::istream & | i,
|  | basic_json & | j
| ) |  |
| friend
  Deserializes an input stream to a JSON value. Parameters
  [in,out] | i | input stream to read a serialized JSON value from
  [in,out] | j | JSON value to write the deserialized input to
  Exceptions
  parse_error.101 | in case of an unexpected token
  parse_error.102 | if to_unicode fails or surrogate error
  parse_error.103 | if to_unicode fails
  parse_error.111 | if input stream is in a bad state
  Complexity Linear in the length of the input. The parser is a predictive LL(1) parser. Note A UTF-8 byte order mark is silently ignored. Example The example below shows how a JSON value is constructed by reading a serialization from a stream. 1 #include "json.hpp" 2 #include <iomanip> // for std::setw 3 4 using json = nlohmann::json; 5 6 int main() 7 { 8 // create stream with serialized JSON 9 std::stringstream ss; 10 ss << R"({ 11 "number": 23, 12 "string": "Hello, world!", 13 "array": [1, 2, 3, 4, 5], 14 "boolean": false, 15 "null": null 16 })"; 17 18 // create JSON value and read the serialization from the stream 19 json j; 20 j << ss; 21 22 // serialize JSON 23 std::cout << std::setw(2) << j << '\n'; 24 } nlohmann::json basic_json<> json default JSON class Definition: json.hpp:13933 Output (play with this example online):
      {
        "array": [
          1,
          2,
          3,
          4,
          5
        ],
        "boolean": false,
        "null": null,
        "number": 23,
        "string": "Hello, world!"
      }
  The example code above can be translated with
      g++ -std=c++11 -Isrc doc/examples/operator_deserialize.cpp -o operator_deserialize
See also parse(std::istream&, const parser_callback_t) for a variant with a parser callback function to filter values while parsing Since version 1.0.0 Definition at line 7553 of file json.hpp.