JSON for Modern C++ 2.0.10

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
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
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
diff
difference_type
dump
emplace
emplace_back
empty
end
end
erase
erase
erase
erase
find
find
flatten
from_cbor
from_msgpack
front
front
get
get
get
get_allocator
get_ptr
get_ptr
get_ref
get_ref
insert
insert
insert
insert
insert
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
max_size
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[]
parse
parse
parse
parse
parse
parse
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
unflatten
value
value
value
value
value_t
value_type
~basic_json
| ## § parse() [6/6] 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<class ContiguousContainer , typename std::enable_if< not std::is_pointer< ContiguousContainer >::value and std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(std::begin(std::declval< ContiguousContainer const >()))>::iterator_category >::value, int >::type = 0>
static basic_json nlohmann::basic_json::parse | ( | const ContiguousContainer & | c,
|  | const parser_callback_t | cb = `nullptr`
| ) |  |
| inline static
  This function reads from a container with contiguous storage of 1-byte values. Compatible container types include `std::vector`, `std::string`, `std::array`, and `std::initializer_list`. User-defined containers can be used as long as they implement random-access iterators and a contiguous storage. Precondition The container storage is contiguous. Violating this precondition yields undefined behavior. This precondition is enforced with an assertion. Each element of the container has a size of 1 byte. Violating this precondition yields undefined behavior. This precondition is enforced with a static assertion. Warning There is no way to enforce all preconditions at compile-time. If the function is called with a noncompliant container and with assertions switched off, the behavior is undefined and will most likely yield segmentation violation. Template Parameters
  ContiguousContainer | container type with contiguous storage
  Parameters
  [in] | c | container to read from
  [in] | cb | a parser callback function of type parser_callback_t which is used to control the deserialization by filtering unwanted values (optional)
  Returns result of the deserialization Complexity Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser callback function cb has a super-linear complexity. Note A UTF-8 byte order mark is silently ignored. Example The example below demonstrates the `parse()` function reading from a contiguous container. 1 #include <json.hpp> 2 3 using json = nlohmann::json; 4 5 int main() 6 { 7 // a JSON text given as std::vector 8 std::vector<uint8_t> text = {'[', '1', ',', '2', ',', '3', ']', '\0'}; 9 10 // parse and serialize JSON 11 json j_complete = json::parse(text); 12 std::cout << std::setw(4) << j_complete << "\n\n"; 13 } nlohmann::json basic_json<> json default JSON class Definition: json.hpp:12151 nlohmann::basic_json::parse static basic_json parse(T(&array)[N], const parser_callback_t cb=nullptr) deserialize from an array Definition: json.hpp:5963 Output (play with this example online):
      [
          1,
          2,
          3
      ]
  The example code above can be translated with
      g++ -std=c++11 -Isrc doc/examples/parse__contiguouscontainer__parser_callback_t.cpp -o parse__contiguouscontainer__parser_callback_t
Since version 2.0.3 Definition at line 6163 of file json.hpp.