From e41981a7513915a95664bc57f41baa6f87da39fc Mon Sep 17 00:00:00 2001 From: nlohmann Date: Fri, 21 Feb 2025 07:33:23 +0000 Subject: [PATCH] deploy: 8215dbafbdab7c166fad02db86d4ea2a82f851c7 --- 404.html | 2 +- api/adl_serializer/from_json/index.html | 4 +- api/adl_serializer/index.html | 4 +- api/adl_serializer/to_json/index.html | 4 +- api/basic_json/accept/index.html | 4 +- api/basic_json/array/index.html | 4 +- api/basic_json/array_t/index.html | 4 +- api/basic_json/at/index.html | 4 +- api/basic_json/back/index.html | 4 +- api/basic_json/basic_json/index.html | 4 +- api/basic_json/begin/index.html | 4 +- api/basic_json/binary/index.html | 4 +- api/basic_json/binary_t/index.html | 4 +- api/basic_json/boolean_t/index.html | 4 +- api/basic_json/cbegin/index.html | 4 +- api/basic_json/cbor_tag_handler_t/index.html | 4 +- api/basic_json/cend/index.html | 4 +- api/basic_json/clear/index.html | 4 +- api/basic_json/contains/index.html | 4 +- api/basic_json/count/index.html | 4 +- api/basic_json/crbegin/index.html | 4 +- api/basic_json/crend/index.html | 4 +- .../default_object_comparator_t/index.html | 4 +- api/basic_json/diff/index.html | 4 +- api/basic_json/dump/index.html | 4 +- api/basic_json/emplace/index.html | 4 +- api/basic_json/emplace_back/index.html | 4 +- api/basic_json/empty/index.html | 4 +- api/basic_json/end/index.html | 4 +- api/basic_json/end_pos/index.html | 4 +- api/basic_json/erase/index.html | 4 +- api/basic_json/error_handler_t/index.html | 4 +- api/basic_json/exception/index.html | 4 +- api/basic_json/find/index.html | 4 +- api/basic_json/flatten/index.html | 4 +- api/basic_json/from_bjdata/index.html | 4 +- api/basic_json/from_bson/index.html | 4 +- api/basic_json/from_cbor/index.html | 4 +- api/basic_json/from_msgpack/index.html | 4 +- api/basic_json/from_ubjson/index.html | 4 +- api/basic_json/front/index.html | 4 +- api/basic_json/get/index.html | 4 +- api/basic_json/get_allocator/index.html | 4 +- api/basic_json/get_binary/index.html | 4 +- api/basic_json/get_ptr/index.html | 4 +- api/basic_json/get_ref/index.html | 4 +- api/basic_json/get_to/index.html | 4 +- api/basic_json/index.html | 4 +- api/basic_json/input_format_t/index.html | 4 +- api/basic_json/insert/index.html | 4 +- api/basic_json/invalid_iterator/index.html | 4 +- api/basic_json/is_array/index.html | 4 +- api/basic_json/is_binary/index.html | 4 +- api/basic_json/is_boolean/index.html | 4 +- api/basic_json/is_discarded/index.html | 4 +- api/basic_json/is_null/index.html | 4 +- api/basic_json/is_number/index.html | 4 +- api/basic_json/is_number_float/index.html | 4 +- api/basic_json/is_number_integer/index.html | 4 +- api/basic_json/is_number_unsigned/index.html | 4 +- api/basic_json/is_object/index.html | 4 +- api/basic_json/is_primitive/index.html | 4 +- api/basic_json/is_string/index.html | 4 +- api/basic_json/is_structured/index.html | 4 +- api/basic_json/items/index.html | 4 +- api/basic_json/json_base_class_t/index.html | 4 +- api/basic_json/json_serializer/index.html | 4 +- api/basic_json/max_size/index.html | 4 +- api/basic_json/merge_patch/index.html | 4 +- api/basic_json/meta/index.html | 4 +- api/basic_json/number_float_t/index.html | 4 +- api/basic_json/number_integer_t/index.html | 4 +- api/basic_json/number_unsigned_t/index.html | 4 +- api/basic_json/object/index.html | 4 +- api/basic_json/object_comparator_t/index.html | 4 +- api/basic_json/object_t/index.html | 4 +- api/basic_json/operator+=/index.html | 4 +- api/basic_json/operator=/index.html | 4 +- api/basic_json/operator[]/index.html | 4 +- api/basic_json/operator_ValueType/index.html | 4 +- api/basic_json/operator_eq/index.html | 4 +- api/basic_json/operator_ge/index.html | 4 +- api/basic_json/operator_gt/index.html | 4 +- api/basic_json/operator_le/index.html | 4 +- api/basic_json/operator_lt/index.html | 4 +- api/basic_json/operator_ne/index.html | 4 +- api/basic_json/operator_spaceship/index.html | 4 +- api/basic_json/operator_value_t/index.html | 4 +- api/basic_json/other_error/index.html | 4 +- api/basic_json/out_of_range/index.html | 4 +- api/basic_json/parse/index.html | 4 +- api/basic_json/parse_error/index.html | 4 +- api/basic_json/parse_event_t/index.html | 4 +- api/basic_json/parser_callback_t/index.html | 4 +- api/basic_json/patch/index.html | 4 +- api/basic_json/patch_inplace/index.html | 4 +- api/basic_json/push_back/index.html | 4 +- api/basic_json/rbegin/index.html | 4 +- api/basic_json/rend/index.html | 4 +- api/basic_json/sax_parse/index.html | 4 +- api/basic_json/size/index.html | 4 +- api/basic_json/start_pos/index.html | 4 +- api/basic_json/std_hash/index.html | 4 +- api/basic_json/std_swap/index.html | 4 +- api/basic_json/string_t/index.html | 4 +- api/basic_json/swap/index.html | 4 +- api/basic_json/to_bjdata/index.html | 4 +- api/basic_json/to_bson/index.html | 4 +- api/basic_json/to_cbor/index.html | 4 +- api/basic_json/to_msgpack/index.html | 4 +- api/basic_json/to_string/index.html | 4 +- api/basic_json/to_ubjson/index.html | 4 +- api/basic_json/type/index.html | 4 +- api/basic_json/type_error/index.html | 4 +- api/basic_json/type_name/index.html | 4 +- api/basic_json/unflatten/index.html | 4 +- api/basic_json/update/index.html | 4 +- api/basic_json/value/index.html | 4 +- api/basic_json/value_t/index.html | 4 +- api/basic_json/~basic_json/index.html | 4 +- .../byte_container_with_subtype/index.html | 4 +- .../clear_subtype/index.html | 4 +- .../has_subtype/index.html | 4 +- api/byte_container_with_subtype/index.html | 4 +- .../set_subtype/index.html | 4 +- .../subtype/index.html | 4 +- api/json/index.html | 4 +- api/json_pointer/back/index.html | 4 +- api/json_pointer/empty/index.html | 4 +- api/json_pointer/index.html | 4 +- api/json_pointer/json_pointer/index.html | 4 +- api/json_pointer/operator_eq/index.html | 4 +- api/json_pointer/operator_ne/index.html | 4 +- api/json_pointer/operator_slash/index.html | 4 +- api/json_pointer/operator_slasheq/index.html | 4 +- api/json_pointer/operator_string_t/index.html | 4 +- api/json_pointer/parent_pointer/index.html | 4 +- api/json_pointer/pop_back/index.html | 4 +- api/json_pointer/push_back/index.html | 4 +- api/json_pointer/string_t/index.html | 4 +- api/json_pointer/to_string/index.html | 4 +- api/json_sax/binary/index.html | 4 +- api/json_sax/boolean/index.html | 4 +- api/json_sax/end_array/index.html | 4 +- api/json_sax/end_object/index.html | 4 +- api/json_sax/index.html | 4 +- api/json_sax/key/index.html | 4 +- api/json_sax/null/index.html | 4 +- api/json_sax/number_float/index.html | 4 +- api/json_sax/number_integer/index.html | 4 +- api/json_sax/number_unsigned/index.html | 4 +- api/json_sax/parse_error/index.html | 4 +- api/json_sax/start_array/index.html | 4 +- api/json_sax/start_object/index.html | 4 +- api/json_sax/string/index.html | 4 +- api/macros/index.html | 2 +- api/macros/json_assert/index.html | 4 +- .../json_diagnostic_positions/index.html | 4 +- api/macros/json_diagnostics/index.html | 4 +- .../index.html | 4 +- api/macros/json_has_cpp_11/index.html | 4 +- api/macros/json_has_filesystem/index.html | 4 +- api/macros/json_has_ranges/index.html | 4 +- api/macros/json_has_static_rtti/index.html | 4 +- .../json_has_three_way_comparison/index.html | 4 +- api/macros/json_no_io/index.html | 4 +- api/macros/json_noexception/index.html | 4 +- .../index.html | 4 +- .../index.html | 4 +- api/macros/json_throw_user/index.html | 4 +- api/macros/json_use_global_udls/index.html | 4 +- .../json_use_implicit_conversions/index.html | 4 +- .../index.html | 4 +- .../nlohmann_define_derived_type/index.html | 4 +- .../nlohmann_define_type_intrusive/index.html | 4 +- .../index.html | 4 +- api/macros/nlohmann_json_namespace/index.html | 4 +- .../nlohmann_json_namespace_begin/index.html | 4 +- .../index.html | 4 +- .../nlohmann_json_serialize_enum/index.html | 4 +- .../nlohmann_json_version_major/index.html | 4 +- api/operator_gtgt/index.html | 4 +- api/operator_literal_json/index.html | 4 +- api/operator_literal_json_pointer/index.html | 4 +- api/operator_ltlt/index.html | 4 +- api/ordered_json/index.html | 4 +- api/ordered_map/index.html | 4 +- .../fonts.googleapis.com/css.61a430c9.css | 756 ------------------ .../cocoapods/v/nlohmann_json.svg | 1 - .../conda/v/conda-forge/nlohmann_json.svg | 1 - community/code_of_conduct/index.html | 2 +- community/contribution_guidelines/index.html | 4 +- community/governance/index.html | 2 +- community/index.html | 2 +- community/quality_assurance/index.html | 4 +- community/security_policy/index.html | 2 +- features/arbitrary_types/index.html | 4 +- features/assertions/index.html | 4 +- features/binary_formats/bjdata/index.html | 4 +- features/binary_formats/bson/index.html | 4 +- features/binary_formats/cbor/index.html | 4 +- features/binary_formats/index.html | 2 +- .../binary_formats/messagepack/index.html | 4 +- features/binary_formats/ubjson/index.html | 4 +- features/binary_values/index.html | 4 +- features/comments/index.html | 4 +- .../element_access/checked_access/index.html | 4 +- .../element_access/default_value/index.html | 4 +- features/element_access/index.html | 2 +- .../unchecked_access/index.html | 4 +- features/enum_conversion/index.html | 4 +- features/iterators/index.html | 4 +- features/json_patch/index.html | 4 +- features/json_pointer/index.html | 4 +- features/macros/index.html | 2 +- features/merge_patch/index.html | 4 +- features/namespace/index.html | 4 +- features/object_order/index.html | 4 +- features/parsing/index.html | 2 +- features/parsing/json_lines/index.html | 4 +- features/parsing/parse_exceptions/index.html | 4 +- features/parsing/parser_callbacks/index.html | 4 +- features/parsing/sax_interface/index.html | 4 +- features/types/index.html | 4 +- features/types/number_handling/index.html | 4 +- home/architecture/index.html | 4 +- home/customers/index.html | 2 +- home/design_goals/index.html | 2 +- home/exceptions/index.html | 4 +- home/faq/index.html | 4 +- home/license/index.html | 2 +- home/releases/index.html | 4 +- home/sponsors/index.html | 2 +- index.html | 2 +- integration/cmake/index.html | 4 +- integration/index.html | 4 +- integration/migration_guide/index.html | 4 +- integration/package_managers/index.html | 6 +- integration/pkg-config/index.html | 4 +- sitemap.xml | 470 +++++------ sitemap.xml.gz | Bin 1725 -> 1725 bytes 241 files changed, 693 insertions(+), 1451 deletions(-) delete mode 100644 assets/external/fonts.googleapis.com/css.61a430c9.css delete mode 100644 assets/external/img.shields.io/cocoapods/v/nlohmann_json.svg delete mode 100644 assets/external/img.shields.io/conda/v/conda-forge/nlohmann_json.svg diff --git a/404.html b/404.html index 3d3a0bf08..ce9419df6 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ - JSON for Modern C++

404 - Not found

\ No newline at end of file + JSON for Modern C++

404 - Not found

\ No newline at end of file diff --git a/api/adl_serializer/from_json/index.html b/api/adl_serializer/from_json/index.html index ec1de97c6..0937d249b 100644 --- a/api/adl_serializer/from_json/index.html +++ b/api/adl_serializer/from_json/index.html @@ -1,4 +1,4 @@ - from_json - JSON for Modern C++
Skip to content

nlohmann::adl_serializer::from_json

// (1)
+ from_json - JSON for Modern C++      

nlohmann::adl_serializer::from_json

// (1)
 template<typename BasicJsonType, typename TargetType = ValueType>
 static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
     noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
@@ -101,4 +101,4 @@
     std::cout << p.name << " (" << p.age << ") lives in " << p.address << std::endl;
 }
 

Output:

Ned Flanders (60) lives in 744 Evergreen Terrace
-

See also

Version history

  • Added in version 2.1.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.1.0.
\ No newline at end of file diff --git a/api/adl_serializer/index.html b/api/adl_serializer/index.html index 609e75b84..203dcb7fe 100644 --- a/api/adl_serializer/index.html +++ b/api/adl_serializer/index.html @@ -1,4 +1,4 @@ - Overview - JSON for Modern C++
Skip to content

nlohmann::adl_serializer

template<typename, typename>
+ Overview - JSON for Modern C++      

nlohmann::adl_serializer

template<typename, typename>
 struct adl_serializer;
 

Serializer that uses ADL (Argument-Dependent Lookup) to choose to_json/from_json functions from the types' namespaces.

It is implemented similar to

template<typename ValueType>
 struct adl_serializer {
@@ -12,4 +12,4 @@
         // same thing, but with the "from_json" method
     }
 };
-

Member functions

  • from_json - convert a JSON value to any value type
  • to_json - convert any value type to a JSON value

Version history

  • Added in version 2.1.0.
\ No newline at end of file +

Member functions

  • from_json - convert a JSON value to any value type
  • to_json - convert any value type to a JSON value

Version history

  • Added in version 2.1.0.
\ No newline at end of file diff --git a/api/adl_serializer/to_json/index.html b/api/adl_serializer/to_json/index.html index bede01d36..68a34fe66 100644 --- a/api/adl_serializer/to_json/index.html +++ b/api/adl_serializer/to_json/index.html @@ -1,4 +1,4 @@ - to_json - JSON for Modern C++
Skip to content

nlohmann::adl_serializer::to_json

template<typename BasicJsonType, typename TargetType = ValueType>
+ to_json - JSON for Modern C++      

nlohmann::adl_serializer::to_json

template<typename BasicJsonType, typename TargetType = ValueType>
 static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
     noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
 -> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
@@ -35,4 +35,4 @@
     std::cout << j << std::endl;
 }
 

Output:

{"address":"744 Evergreen Terrace","age":60,"name":"Ned Flanders"}
-

See also

Version history

  • Added in version 2.1.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.1.0.
\ No newline at end of file diff --git a/api/basic_json/accept/index.html b/api/basic_json/accept/index.html index bce57fc35..e6fb2b5b7 100644 --- a/api/basic_json/accept/index.html +++ b/api/basic_json/accept/index.html @@ -1,4 +1,4 @@ - accept - JSON for Modern C++
Skip to content

nlohmann::basic_json::accept

// (1)
+ accept - JSON for Modern C++      

nlohmann::basic_json::accept

// (1)
 template<typename InputType>
 static bool accept(InputType&& i,
                    const bool ignore_comments = false);
@@ -34,4 +34,4 @@
               << json::accept(invalid_text) << '\n';
 }
 

Output:

true false
-

See also

  • parse - deserialize from a compatible input
  • operator>> - deserialize from stream

Version history

  • Added in version 3.0.0.
  • Ignoring comments via ignore_comments added in version 3.9.0.
  • Changed runtime assertion in case of FILE* null pointers to exception in version 3.11.4.

Deprecation

Overload (2) replaces calls to accept with a pair of iterators as their first parameter which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like accept({ptr, ptr+len}, ...); with accept(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

See also

  • parse - deserialize from a compatible input
  • operator>> - deserialize from stream

Version history

  • Added in version 3.0.0.
  • Ignoring comments via ignore_comments added in version 3.9.0.
  • Changed runtime assertion in case of FILE* null pointers to exception in version 3.11.4.

Deprecation

Overload (2) replaces calls to accept with a pair of iterators as their first parameter which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like accept({ptr, ptr+len}, ...); with accept(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/array/index.html b/api/basic_json/array/index.html index 77a4e397d..f8abfdaf5 100644 --- a/api/basic_json/array/index.html +++ b/api/basic_json/array/index.html @@ -1,4 +1,4 @@ - array - JSON for Modern C++
Skip to content

nlohmann::basic_json::array

static basic_json array(initializer_list_t init = {});
+ array - JSON for Modern C++      

nlohmann::basic_json::array

static basic_json array(initializer_list_t init = {});
 

Creates a JSON array value from a given initializer list. That is, given a list of values a, b, c, creates the JSON value [a, b, c]. If the initializer list is empty, the empty array [] is created.

Parameters

init (in)
initializer list with JSON values to create an array from (optional)

Return value

JSON array value

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the JSON value.

Complexity

Linear in the size of init.

Notes

This function is only needed to express two edge cases that cannot be realized with the initializer list constructor (basic_json(initializer_list_t, bool, value_t)). These cases are:

  1. creating an array whose elements are all pairs whose first element is a string -- in this case, the initializer list constructor would create an object, taking the first elements as keys
  2. creating an empty array -- passing the empty initializer list to the initializer list constructor yields an empty object

Examples

Example

The following code shows an example for the array function.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -22,4 +22,4 @@
 []
 [1,2,3,4]
 [["one",1],["two",2]]
-

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/array_t/index.html b/api/basic_json/array_t/index.html index 29d85aefe..836379709 100644 --- a/api/basic_json/array_t/index.html +++ b/api/basic_json/array_t/index.html @@ -1,4 +1,4 @@ - array_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::array_t

using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
+ array_t - JSON for Modern C++      

nlohmann::basic_json::array_t

using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
 

The type used to store JSON arrays.

RFC 8259 describes JSON arrays as follows:

An array is an ordered sequence of zero or more values.

To store objects in C++, a type is defined by the template parameters explained below.

Template parameters

ArrayType
container type to store arrays (e.g., std::vector or std::list)
AllocatorType
the allocator to use for objects (e.g., std::allocator)

Notes

Default type

With the default values for ArrayType (std::vector) and AllocatorType (std::allocator), the default value for array_t is:

std::vector<
   basic_json, // value_type
   std::allocator<basic_json> // allocator_type
@@ -14,4 +14,4 @@
     std::cout << std::boolalpha << std::is_same<std::vector<json>, json::array_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/at/index.html b/api/basic_json/at/index.html index 0eed560dc..283cbcb4f 100644 --- a/api/basic_json/at/index.html +++ b/api/basic_json/at/index.html @@ -1,4 +1,4 @@ - at - JSON for Modern C++
Skip to content

nlohmann::basic_json::at

// (1)
+ at - JSON for Modern C++      

nlohmann::basic_json::at

// (1)
 reference at(size_type idx);
 const_reference at(size_type idx) const;
 
@@ -498,4 +498,4 @@
 [json.exception.out_of_range.402] array index '-' (2) is out of range
 [json.exception.out_of_range.403] key 'foo' not found
 [json.exception.out_of_range.404] unresolved reference token 'foo'
-

See also

Version history

  1. Added in version 1.0.0.
  2. Added in version 1.0.0.
  3. Added in version 3.11.0.
  4. Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 1.0.0.
  2. Added in version 1.0.0.
  3. Added in version 3.11.0.
  4. Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/back/index.html b/api/basic_json/back/index.html index 1e96a5a2d..54495baed 100644 --- a/api/basic_json/back/index.html +++ b/api/basic_json/back/index.html @@ -1,4 +1,4 @@ - back - JSON for Modern C++
Skip to content

nlohmann::basic_json::back

reference back();
+ back - JSON for Modern C++      

nlohmann::basic_json::back

reference back();
 
 const_reference back() const;
 

Returns a reference to the last element in the container. For a JSON container c, the expression c.back() is equivalent to

auto tmp = c.end();
@@ -49,4 +49,4 @@
 16
 "Hello, world"
 [json.exception.invalid_iterator.214] cannot get value
-

See also

  • front to access the first element

Version history

  • Added in version 1.0.0.
  • Adjusted code to return reference to binary values in version 3.8.0.
\ No newline at end of file +

See also

  • front to access the first element

Version history

  • Added in version 1.0.0.
  • Adjusted code to return reference to binary values in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/basic_json/index.html b/api/basic_json/basic_json/index.html index be2330f54..c7f6af5f8 100644 --- a/api/basic_json/basic_json/index.html +++ b/api/basic_json/basic_json/index.html @@ -1,4 +1,4 @@ - (Constructor) - JSON for Modern C++
Skip to content

nlohmann::basic_json::basic_json

// (1)
+ (Constructor) - JSON for Modern C++      

nlohmann::basic_json::basic_json

// (1)
 basic_json(const value_t v);
 
 // (2)
@@ -455,4 +455,4 @@
 }
 

Output:

null
 23
-

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 2.1.0.
  4. Since version 3.2.0.
  5. Since version 1.0.0.
  6. Since version 1.0.0.
  7. Since version 1.0.0.
  8. Since version 1.0.0.
  9. Since version 1.0.0.
\ No newline at end of file +

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 2.1.0.
  4. Since version 3.2.0.
  5. Since version 1.0.0.
  6. Since version 1.0.0.
  7. Since version 1.0.0.
  8. Since version 1.0.0.
  9. Since version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/begin/index.html b/api/basic_json/begin/index.html index 8340cc6ce..ca6e40b0f 100644 --- a/api/basic_json/begin/index.html +++ b/api/basic_json/begin/index.html @@ -1,4 +1,4 @@ - begin - JSON for Modern C++
Skip to content

nlohmann::basic_json::begin

iterator begin() noexcept;
+ begin - JSON for Modern C++      

nlohmann::basic_json::begin

iterator begin() noexcept;
 const_iterator begin() const noexcept;
 

Returns an iterator to the first element.

Illustration from cppreference.com

Return value

iterator to the first element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for begin().

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -17,4 +17,4 @@
     std::cout << *it << '\n';
 }
 

Output:

1
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/binary/index.html b/api/basic_json/binary/index.html index 24dc665bf..ac8968fd6 100644 --- a/api/basic_json/binary/index.html +++ b/api/basic_json/binary/index.html @@ -1,4 +1,4 @@ - binary - JSON for Modern C++
Skip to content

nlohmann::basic_json::binary

// (1)
+ binary - JSON for Modern C++      

nlohmann::basic_json::binary

// (1)
 static basic_json binary(const typename binary_t::container_type& init);
 static basic_json binary(typename binary_t::container_type&& init);
 
@@ -24,4 +24,4 @@
     std::cout << "type: " << j.type_name() << ", subtype: " << j.get_binary().subtype() << std::endl;
 }
 

Output:

type: binary, subtype: 42
-

Version history

  • Added in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/binary_t/index.html b/api/basic_json/binary_t/index.html index d9177aca3..4a55109b4 100644 --- a/api/basic_json/binary_t/index.html +++ b/api/basic_json/binary_t/index.html @@ -1,4 +1,4 @@ - binary_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::binary_t

using binary_t = byte_container_with_subtype<BinaryType>;
+ binary_t - JSON for Modern C++      

nlohmann::basic_json::binary_t

using binary_t = byte_container_with_subtype<BinaryType>;
 

This type is a type designed to carry binary data that appears in various serialized formats, such as CBOR's Major Type 2, MessagePack's bin, and BSON's generic binary subtype. This type is NOT a part of standard JSON and exists solely for compatibility with these binary types. As such, it is simply defined as an ordered sequence of zero or more byte values.

Additionally, as an implementation detail, the subtype of the binary data is carried around as a std::uint64_t, which is compatible with both of the binary data formats that use binary subtyping, (though the specific numbering is incompatible with each other, and it is up to the user to translate between them). The subtype is added to BinaryType via the helper type byte_container_with_subtype.

CBOR's RFC 7049 describes this type as:

Major type 2: a byte string. The string's length in bytes is represented following the rules for positive integers (major type 0).

MessagePack's documentation on the bin type family describes this type as:

Bin format family stores a byte array in 2, 3, or 5 bytes of extra bytes in addition to the size of the byte array.

BSON's specifications describe several binary types; however, this type is intended to represent the generic binary type which has the description:

Generic binary subtype - This is the most commonly used binary subtype and should be the 'default' for drivers and tools.

None of these impose any limitations on the internal representation other than the basic unit of storage be some type of array whose parts are decomposable into bytes.

The default representation of this binary format is a std::vector<std::uint8_t>, which is a very common way to represent a byte array in modern C++.

Template parameters

BinaryType
container type to store arrays

Notes

Default type

The default values for BinaryType is std::vector<std::uint8_t>.

Storage

Binary Arrays are stored as pointers in a basic_json type. That is, for any access to array values, a pointer of the type binary_t* must be dereferenced.

Notes on subtypes

  • CBOR

    • Binary values are represented as byte strings. Subtypes are written as tags.
  • MessagePack

    • If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1, fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is then added as signed 8-bit integer.
    • If no subtype is given, the bin family (bin8, bin16, bin32) is used.
  • BSON

    • If a subtype is given, it is used and added as unsigned 8-bit integer.
    • If no subtype is given, the generic binary subtype 0x00 is used.

Examples

Example

The following code shows that binary_t is by default, a typedef to nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -10,4 +10,4 @@
     std::cout << std::boolalpha << std::is_same<nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>, json::binary_t>::value << std::endl;
 }
 

Output:

true
-

See also

Version history

  • Added in version 3.8.0. Changed type of subtype to std::uint64_t in version 3.10.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.8.0. Changed type of subtype to std::uint64_t in version 3.10.0.
\ No newline at end of file diff --git a/api/basic_json/boolean_t/index.html b/api/basic_json/boolean_t/index.html index eba2bc1b7..9c6ca4b5e 100644 --- a/api/basic_json/boolean_t/index.html +++ b/api/basic_json/boolean_t/index.html @@ -1,4 +1,4 @@ - boolean_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::boolean_t

using boolean_t = BooleanType;
+ boolean_t - JSON for Modern C++      

nlohmann::basic_json::boolean_t

using boolean_t = BooleanType;
 

The type used to store JSON booleans.

RFC 8259 implicitly describes a boolean as a type which differentiates the two literals true and false.

To store objects in C++, a type is defined by the template parameter BooleanType which chooses the type to use.

Notes

Default type

With the default values for BooleanType (bool), the default value for boolean_t is bool.

Storage

Boolean values are stored directly inside a basic_json type.

Examples

Example

The following code shows that boolean_t is by default, a typedef to bool.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -10,4 +10,4 @@
     std::cout << std::boolalpha << std::is_same<bool, json::boolean_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/cbegin/index.html b/api/basic_json/cbegin/index.html index 7e00084c8..dddbbde2b 100644 --- a/api/basic_json/cbegin/index.html +++ b/api/basic_json/cbegin/index.html @@ -1,4 +1,4 @@ - cbegin - JSON for Modern C++
Skip to content

nlohmann::basic_json::cbegin

const_iterator cbegin() const noexcept;
+ cbegin - JSON for Modern C++      

nlohmann::basic_json::cbegin

const_iterator cbegin() const noexcept;
 

Returns an iterator to the first element.

Illustration from cppreference.com

Return value

iterator to the first element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for cbegin().

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -16,4 +16,4 @@
     std::cout << *it << '\n';
 }
 

Output:

1
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/cbor_tag_handler_t/index.html b/api/basic_json/cbor_tag_handler_t/index.html index d0ef2dcad..d0b287eb7 100644 --- a/api/basic_json/cbor_tag_handler_t/index.html +++ b/api/basic_json/cbor_tag_handler_t/index.html @@ -1,4 +1,4 @@ - cbor_tag_handler_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::cbor_tag_handler_t

enum class cbor_tag_handler_t
+ cbor_tag_handler_t - JSON for Modern C++      

nlohmann::basic_json::cbor_tag_handler_t

enum class cbor_tag_handler_t
 {
     error,
     ignore,
@@ -35,4 +35,4 @@
 

Output:

[json.exception.parse_error.112] parse error at byte 1: syntax error while parsing CBOR value: invalid byte: 0xD8
 {"bytes":[202,254,186,190],"subtype":null}
 {"bytes":[202,254,186,190],"subtype":66}
-

Version history

  • Added in version 3.9.0. Added value store in 3.10.0.
\ No newline at end of file +

Version history

  • Added in version 3.9.0. Added value store in 3.10.0.
\ No newline at end of file diff --git a/api/basic_json/cend/index.html b/api/basic_json/cend/index.html index 357c2ddda..275510104 100644 --- a/api/basic_json/cend/index.html +++ b/api/basic_json/cend/index.html @@ -1,4 +1,4 @@ - cend - JSON for Modern C++
Skip to content

nlohmann::basic_json::cend

const_iterator cend() const noexcept;
+ cend - JSON for Modern C++      

nlohmann::basic_json::cend

const_iterator cend() const noexcept;
 

Returns an iterator to one past the last element.

Illustration from cppreference.com

Return value

iterator one past the last element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for cend().

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -19,4 +19,4 @@
     std::cout << *it << '\n';
 }
 

Output:

5
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/clear/index.html b/api/basic_json/clear/index.html index 0b15ea7a6..d8f6f8701 100644 --- a/api/basic_json/clear/index.html +++ b/api/basic_json/clear/index.html @@ -1,4 +1,4 @@ - clear - JSON for Modern C++
Skip to content

nlohmann::basic_json::clear

void clear() noexcept;
+ clear - JSON for Modern C++      

nlohmann::basic_json::clear

void clear() noexcept;
 

Clears the content of a JSON value and resets it to the default value as if basic_json(value_t) would have been called with the current value type from type():

Value type initial value
null null
boolean false
string ""
number 0
binary An empty byte vector
object {}
array []

Has the same effect as calling

*this = basic_json(type());
 

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Linear in the size of the JSON value.

Notes

All iterators, pointers and references related to this container are invalidated.

Examples

Example

The example below shows the effect of clear() to different JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -41,4 +41,4 @@
 {}
 []
 ""
-

Version history

  • Added in version 1.0.0.
  • Added support for binary types in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Added support for binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/contains/index.html b/api/basic_json/contains/index.html index e15af8a5d..5eb195379 100644 --- a/api/basic_json/contains/index.html +++ b/api/basic_json/contains/index.html @@ -1,4 +1,4 @@ - contains - JSON for Modern C++
Skip to content

nlohmann::basic_json::contains

// (1)
+ contains - JSON for Modern C++      

nlohmann::basic_json::contains

// (1)
 bool contains(const typename object_t::key_type& key) const;
 
 // (2)
@@ -101,4 +101,4 @@
 false
 false
 false
-

Version history

  1. Added in version 3.11.0.
  2. Added in version 3.6.0. Extended template KeyType to support comparable types in version 3.11.0.
  3. Added in version 3.7.0.
\ No newline at end of file +

Version history

  1. Added in version 3.11.0.
  2. Added in version 3.6.0. Extended template KeyType to support comparable types in version 3.11.0.
  3. Added in version 3.7.0.
\ No newline at end of file diff --git a/api/basic_json/count/index.html b/api/basic_json/count/index.html index caeb28594..d24969e27 100644 --- a/api/basic_json/count/index.html +++ b/api/basic_json/count/index.html @@ -1,4 +1,4 @@ - count - JSON for Modern C++
Skip to content

nlohmann::basic_json::count

// (1)
+ count - JSON for Modern C++      

nlohmann::basic_json::count

// (1)
 size_type count(const typename object_t::key_type& key) const;
 
 // (2)
@@ -46,4 +46,4 @@
 }
 

Output:

number of elements with key "two": 1
 number of elements with key "three": 0
-

Version history

  1. Added in version 3.11.0.
  2. Added in version 1.0.0. Changed parameter key type to KeyType&& in version 3.11.0.
\ No newline at end of file +

Version history

  1. Added in version 3.11.0.
  2. Added in version 1.0.0. Changed parameter key type to KeyType&& in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/crbegin/index.html b/api/basic_json/crbegin/index.html index 69f67c16d..d2c22f386 100644 --- a/api/basic_json/crbegin/index.html +++ b/api/basic_json/crbegin/index.html @@ -1,4 +1,4 @@ - crbegin - JSON for Modern C++
Skip to content

nlohmann::basic_json::crbegin

const_reverse_iterator crbegin() const noexcept;
+ crbegin - JSON for Modern C++      

nlohmann::basic_json::crbegin

const_reverse_iterator crbegin() const noexcept;
 

Returns an iterator to the reverse-beginning; that is, the last element.

Illustration from cppreference.com

Return value

reverse iterator to the first element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for crbegin().

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -16,4 +16,4 @@
     std::cout << *it << '\n';
 }
 

Output:

5
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/crend/index.html b/api/basic_json/crend/index.html index cd7b9c9ec..4db0c624f 100644 --- a/api/basic_json/crend/index.html +++ b/api/basic_json/crend/index.html @@ -1,4 +1,4 @@ - crend - JSON for Modern C++
Skip to content

nlohmann::basic_json::crend

const_reverse_iterator crend() const noexcept;
+ crend - JSON for Modern C++      

nlohmann::basic_json::crend

const_reverse_iterator crend() const noexcept;
 

Returns an iterator to the reverse-end; that is, one before the first element. This element acts as a placeholder, attempting to access it results in undefined behavior.

Illustration from cppreference.com

Return value

reverse iterator to the element following the last element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for eend().

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -19,4 +19,4 @@
     std::cout << *it << '\n';
 }
 

Output:

1
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/default_object_comparator_t/index.html b/api/basic_json/default_object_comparator_t/index.html index 6e1ee5f4a..37bdd6dda 100644 --- a/api/basic_json/default_object_comparator_t/index.html +++ b/api/basic_json/default_object_comparator_t/index.html @@ -1,4 +1,4 @@ - default_object_comparator_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::default_object_comparator_t

using default_object_comparator_t = std::less<StringType>;  // until C++14
+ default_object_comparator_t - JSON for Modern C++      

nlohmann::basic_json::default_object_comparator_t

using default_object_comparator_t = std::less<StringType>;  // until C++14
 
 using default_object_comparator_t = std::less<>;            // since C++14
 

The default comparator used by object_t.

Since C++14 a transparent comparator is used which prevents unnecessary string construction when looking up a key in an object.

The actual comparator used depends on object_t and can be obtained via object_comparator_t.

Examples

Example

The example below demonstrates the default comparator.

#include <iostream>
@@ -14,4 +14,4 @@
 }
 

Output:

one < two : true
 three < four : false
-

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/diff/index.html b/api/basic_json/diff/index.html index f401636d1..ed3b1ba12 100644 --- a/api/basic_json/diff/index.html +++ b/api/basic_json/diff/index.html @@ -1,4 +1,4 @@ - diff - JSON for Modern C++
Skip to content

nlohmann::basic_json::diff

static basic_json diff(const basic_json& source,
+ diff - JSON for Modern C++      

nlohmann::basic_json::diff

static basic_json diff(const basic_json& source,
                        const basic_json& target);
 

Creates a JSON Patch so that value source can be changed into the value target by calling patch function.

For two JSON values source and target, the following code yields always true:

source.patch(diff(source, target)) == target;
 

Parameters

source (in)
JSON value to compare from
target (in)
JSON value to compare against

Return value

a JSON patch to convert the source to target

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the JSON value.

Complexity

Linear in the lengths of source and target.

Notes

Currently, only remove, add, and replace operations are generated.

Examples

Example

The following code shows how a JSON patch is created as a diff for two JSON values.

#include <iostream>
@@ -63,4 +63,4 @@
         "world"
     ]
 }
-

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/dump/index.html b/api/basic_json/dump/index.html index 089bac108..ab4610d88 100644 --- a/api/basic_json/dump/index.html +++ b/api/basic_json/dump/index.html @@ -1,4 +1,4 @@ - dump - JSON for Modern C++
Skip to content

nlohmann::basic_json::dump

string_t dump(const int indent = -1,
+ dump - JSON for Modern C++      

nlohmann::basic_json::dump

string_t dump(const int indent = -1,
               const char indent_char = ' ',
               const bool ensure_ascii = false,
               const error_handler_t error_handler = error_handler_t::strict) const;
@@ -105,4 +105,4 @@
 [json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9
 string with replaced invalid characters: "ä�ü"
 string with ignored invalid characters: "äü"
-

Version history

  • Added in version 1.0.0.
  • Indentation character indent_char, option ensure_ascii and exceptions added in version 3.0.0.
  • Error handlers added in version 3.4.0.
  • Serialization of binary values added in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Indentation character indent_char, option ensure_ascii and exceptions added in version 3.0.0.
  • Error handlers added in version 3.4.0.
  • Serialization of binary values added in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/emplace/index.html b/api/basic_json/emplace/index.html index 8c788452a..032d2efbb 100644 --- a/api/basic_json/emplace/index.html +++ b/api/basic_json/emplace/index.html @@ -1,4 +1,4 @@ - emplace - JSON for Modern C++
Skip to content

nlohmann::basic_json::emplace

template<class... Args>
+ emplace - JSON for Modern C++      

nlohmann::basic_json::emplace

template<class... Args>
 std::pair<iterator, bool> emplace(Args&& ... args);
 

Inserts a new element into a JSON object constructed in-place with the given args if there is no element with the key in the container. If the function is called on a JSON null value, an empty object is created before appending the value created from args.

Template parameters

Args
compatible types to create a basic_json object

Iterator invalidation

For ordered_json, adding a value to an object can yield a reallocation, in which case all iterators (including the end() iterator) and all references to the elements are invalidated.

Parameters

args (in)
arguments to forward to a constructor of basic_json

Return value

a pair consisting of an iterator to the inserted element, or the already-existing element if no insertion happened, and a bool denoting whether the insertion took place.

Exceptions

Throws type_error.311 when called on a type other than JSON object or null; example: "cannot use emplace() with number"

Complexity

Logarithmic in the size of the container, O(log(size())).

Examples

Example

The example shows how emplace() can be used to add elements to a JSON object. Note how the null value was silently converted to a JSON object. Further note how no value is added if there was already one value stored with the same key.

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -37,4 +37,4 @@
 3 true
 {"A":"a","B":"b"}
 "b" false
-

Version history

  • Since version 2.0.8.
\ No newline at end of file +

Version history

  • Since version 2.0.8.
\ No newline at end of file diff --git a/api/basic_json/emplace_back/index.html b/api/basic_json/emplace_back/index.html index 4f13835b5..2cf1a6fd0 100644 --- a/api/basic_json/emplace_back/index.html +++ b/api/basic_json/emplace_back/index.html @@ -1,4 +1,4 @@ - emplace_back - JSON for Modern C++
Skip to content

nlohmann::basic_json::emplace_back

template<class... Args>
+ emplace_back - JSON for Modern C++      

nlohmann::basic_json::emplace_back

template<class... Args>
 reference emplace_back(Args&& ... args);
 

Creates a JSON value from the passed parameters args to the end of the JSON value. If the function is called on a JSON null value, an empty array is created before appending the value created from args.

Template parameters

Args
compatible types to create a basic_json object

Iterator invalidation

By adding an element to the end of the array, a reallocation can happen, in which case all iterators (including the end() iterator) and all references to the elements are invalidated. Otherwise, only the end() iterator is invalidated.

Parameters

args (in)
arguments to forward to a constructor of basic_json

Return value

reference to the inserted element

Exceptions

Throws type_error.311 when called on a type other than JSON array or null; example: "cannot use emplace_back() with number"

Complexity

Amortized constant.

Examples

Example

The example shows how emplace_back() can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -28,4 +28,4 @@
 null
 [1,2,3,4,5,6]
 ["first",["second","second","second"]]
-

See also

Version history

  • Since version 2.0.8.
  • Returns reference since 3.7.0.
\ No newline at end of file +

See also

Version history

  • Since version 2.0.8.
  • Returns reference since 3.7.0.
\ No newline at end of file diff --git a/api/basic_json/empty/index.html b/api/basic_json/empty/index.html index ad57d4f14..4638a53d1 100644 --- a/api/basic_json/empty/index.html +++ b/api/basic_json/empty/index.html @@ -1,4 +1,4 @@ - empty - JSON for Modern C++
Skip to content

nlohmann::basic_json::empty

bool empty() const noexcept;
+ empty - JSON for Modern C++      

nlohmann::basic_json::empty

bool empty() const noexcept;
 

Checks if a JSON value has no elements (i.e. whether its size() is 0).

Return value

The return value depends on the different types and is defined as follows:

Value type return value
null true
boolean false
string false
number false
binary false
object result of function object_t::empty()
array result of function array_t::empty()

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant, as long as array_t and object_t satisfy the Container concept; that is, their empty() functions have constant complexity.

Possible implementation

bool empty() const noexcept
 {
     return size() == 0;
@@ -42,4 +42,4 @@
 false
 true
 false
-

Version history

  • Added in version 1.0.0.
  • Extended to return false for binary types in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Extended to return false for binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/end/index.html b/api/basic_json/end/index.html index 56a86f1c3..47cfae119 100644 --- a/api/basic_json/end/index.html +++ b/api/basic_json/end/index.html @@ -1,4 +1,4 @@ - end - JSON for Modern C++
Skip to content

nlohmann::basic_json::end

iterator end() noexcept;
+ end - JSON for Modern C++      

nlohmann::basic_json::end

iterator end() noexcept;
 const_iterator end() const noexcept;
 

Returns an iterator to one past the last element.

Illustration from cppreference.com

Return value

iterator one past the last element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for end().

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -20,4 +20,4 @@
     std::cout << *it << '\n';
 }
 

Output:

5
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/end_pos/index.html b/api/basic_json/end_pos/index.html index c8d2cc119..21711e767 100644 --- a/api/basic_json/end_pos/index.html +++ b/api/basic_json/end_pos/index.html @@ -1,4 +1,4 @@ - end_pos - JSON for Modern C++
Skip to content

nlohmann::basic_json::end_pos

#if JSON_DIAGNOSTIC_POSITIONS
+ end_pos - JSON for Modern C++      

nlohmann::basic_json::end_pos

#if JSON_DIAGNOSTIC_POSITIONS
 constexpr std::size_t end_pos() const noexcept;
 #endif
 

Returns the position immediately following the last character of the JSON string from which the value was parsed from.

JSON type return value
object position after the closing }
array position after the closing ]
string position after the closing "
number position after the last character
boolean position after e
null position after l

Return value

the position of the character following the last character of the given value in the parsed JSON string, if the value was created by the parse function, or std::string::npos if the value was constructed otherwise

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Notes

Note

The function is only available if macro JSON_DIAGNOSTIC_POSITIONS has been defined to 1 before including the library header.

Invalidation

The returned positions are only valid as long as the JSON value is not changed. The positions are not updated when the JSON value is changed.

Examples

Example
#include <iostream>
@@ -101,4 +101,4 @@ Original string:
 1
 Parsed string: 
 1
-

The output shows the start/end positions of all the objects and fields in the JSON string.

See also

Version history

  • Added in version 3.12.0.
\ No newline at end of file +

The output shows the start/end positions of all the objects and fields in the JSON string.

See also

Version history

  • Added in version 3.12.0.
\ No newline at end of file diff --git a/api/basic_json/erase/index.html b/api/basic_json/erase/index.html index 175776306..435e70a7d 100644 --- a/api/basic_json/erase/index.html +++ b/api/basic_json/erase/index.html @@ -1,4 +1,4 @@ - erase - JSON for Modern C++
Skip to content

nlohmann::basic_json::erase

// (1)
+ erase - JSON for Modern C++      

nlohmann::basic_json::erase

// (1)
 iterator erase(iterator pos);
 const_iterator erase(const_iterator pos);
 
@@ -148,4 +148,4 @@
     std::cout << j_array << '\n';
 }
 

Output:

[0,1,3,4,5]
-

Version history

  1. Added in version 1.0.0. Added support for binary types in version 3.8.0.
  2. Added in version 1.0.0. Added support for binary types in version 3.8.0.
  3. Added in version 1.0.0.
  4. Added in version 3.11.0.
  5. Added in version 1.0.0.
\ No newline at end of file +

Version history

  1. Added in version 1.0.0. Added support for binary types in version 3.8.0.
  2. Added in version 1.0.0. Added support for binary types in version 3.8.0.
  3. Added in version 1.0.0.
  4. Added in version 3.11.0.
  5. Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/error_handler_t/index.html b/api/basic_json/error_handler_t/index.html index eaf4b3c7e..0c465636a 100644 --- a/api/basic_json/error_handler_t/index.html +++ b/api/basic_json/error_handler_t/index.html @@ -1,4 +1,4 @@ - error_handler_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::error_handler_t

enum class error_handler_t {
+ error_handler_t - JSON for Modern C++      

nlohmann::basic_json::error_handler_t

enum class error_handler_t {
     strict,
     replace,
     ignore
@@ -30,4 +30,4 @@
 

Output:

[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9
 string with replaced invalid characters: "ä�ü"
 string with ignored invalid characters: "äü"
-

Version history

  • Added in version 3.4.0.
\ No newline at end of file +

Version history

  • Added in version 3.4.0.
\ No newline at end of file diff --git a/api/basic_json/exception/index.html b/api/basic_json/exception/index.html index 39423fd04..d0be6fb03 100644 --- a/api/basic_json/exception/index.html +++ b/api/basic_json/exception/index.html @@ -1,4 +1,4 @@ - exception - JSON for Modern C++
Skip to content

nlohmann::basic_json::exception

class exception : public std::exception;
+ exception - JSON for Modern C++      

nlohmann::basic_json::exception

class exception : public std::exception;
 

This class is an extension of std::exception objects with a member id for exception ids. It is used as the base class for all exceptions thrown by the basic_json class. This class can hence be used as "wildcard" to catch exceptions, see example below.

classDiagram
   direction LR
 
@@ -49,4 +49,4 @@
 }
 

Output:

message: [json.exception.out_of_range.403] key 'non-existing' not found
 exception id: 403
-

See also

List of exceptions

Version history

  • Since version 3.0.0.
\ No newline at end of file +

See also

List of exceptions

Version history

\ No newline at end of file diff --git a/api/basic_json/find/index.html b/api/basic_json/find/index.html index c64c74b9b..52659dda1 100644 --- a/api/basic_json/find/index.html +++ b/api/basic_json/find/index.html @@ -1,4 +1,4 @@ - find - JSON for Modern C++
Skip to content

nlohmann::basic_json::find

// (1)
+ find - JSON for Modern C++      

nlohmann::basic_json::find

// (1)
 iterator find(const typename object_t::key_type& key);
 const_iterator find(const typename object_t::key_type& key) const;
 
@@ -55,4 +55,4 @@
 

Output:

"two" was found: true
 value at key "two": 2
 "three" was found: false
-

See also

Version history

  1. Added in version 3.11.0.
  2. Added in version 1.0.0. Changed to support comparable types in version 3.11.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 3.11.0.
  2. Added in version 1.0.0. Changed to support comparable types in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/flatten/index.html b/api/basic_json/flatten/index.html index 4026460be..5deb4f9ce 100644 --- a/api/basic_json/flatten/index.html +++ b/api/basic_json/flatten/index.html @@ -1,4 +1,4 @@ - flatten - JSON for Modern C++
Skip to content

nlohmann::basic_json::flatten

basic_json flatten() const;
+ flatten - JSON for Modern C++      

nlohmann::basic_json::flatten

basic_json flatten() const;
 

The function creates a JSON object whose keys are JSON pointers (see RFC 6901) and whose values are all primitive (see is_primitive() for more information). The original JSON value can be restored using the unflatten() function.

Return value

an object that maps JSON pointers to primitive values

Exception safety

Strong exception safety: if an exception occurs, the original value stays intact.

Complexity

Linear in the size the JSON value.

Notes

Empty objects and arrays are flattened to null and will not be reconstructed correctly by the unflatten() function.

Examples

Example

The following code shows how a JSON object is flattened to an object whose keys consist of JSON pointers.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -43,4 +43,4 @@
     "/object/value": 42.99,
     "/pi": 3.141
 }
-

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/from_bjdata/index.html b/api/basic_json/from_bjdata/index.html index a9ffe5f55..1ca5ee831 100644 --- a/api/basic_json/from_bjdata/index.html +++ b/api/basic_json/from_bjdata/index.html @@ -1,4 +1,4 @@ - from_bjdata - JSON for Modern C++
Skip to content

nlohmann::basic_json::from_bjdata

// (1)
+ from_bjdata - JSON for Modern C++      

nlohmann::basic_json::from_bjdata

// (1)
 template<typename InputType>
 static basic_json from_bjdata(InputType&& i,
                               const bool strict = true,
@@ -32,4 +32,4 @@
   "compact": true,
   "schema": 0
 }
-

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/from_bson/index.html b/api/basic_json/from_bson/index.html index ad64848f5..97ac7c236 100644 --- a/api/basic_json/from_bson/index.html +++ b/api/basic_json/from_bson/index.html @@ -1,4 +1,4 @@ - from_bson - JSON for Modern C++
Skip to content

nlohmann::basic_json::from_bson

// (1)
+ from_bson - JSON for Modern C++      

nlohmann::basic_json::from_bson

// (1)
 template<typename InputType>
 static basic_json from_bson(InputType&& i,
                             const bool strict = true,
@@ -33,4 +33,4 @@
   "compact": true,
   "schema": 0
 }
-

See also

Version history

  • Added in version 3.4.0.

Deprecation

  • Overload (2) replaces calls to from_bson with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_bson(ptr, len, ...); with from_bson(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_bson with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_bson({ptr, ptr+len}, ...); with from_bson(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

See also

Version history

  • Added in version 3.4.0.

Deprecation

  • Overload (2) replaces calls to from_bson with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_bson(ptr, len, ...); with from_bson(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_bson with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_bson({ptr, ptr+len}, ...); with from_bson(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/from_cbor/index.html b/api/basic_json/from_cbor/index.html index a95178b5f..9335e2c8e 100644 --- a/api/basic_json/from_cbor/index.html +++ b/api/basic_json/from_cbor/index.html @@ -1,4 +1,4 @@ - from_cbor - JSON for Modern C++
Skip to content

nlohmann::basic_json::from_cbor

// (1)
+ from_cbor - JSON for Modern C++      

nlohmann::basic_json::from_cbor

// (1)
 template<typename InputType>
 static basic_json from_cbor(InputType&& i,
                             const bool strict = true,
@@ -35,4 +35,4 @@
   "compact": true,
   "schema": 0
 }
-

Version history

  • Added in version 2.0.9.
  • Parameter start_index since version 2.1.1.
  • Changed to consume input adapters, removed start_index parameter, and added strict parameter in version 3.0.0.
  • Added allow_exceptions parameter in version 3.2.0.
  • Added tag_handler parameter in version 3.9.0.

Deprecation

  • Overload (2) replaces calls to from_cbor with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_cbor(ptr, len, ...); with from_cbor(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_cbor with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_cbor({ptr, ptr+len}, ...); with from_cbor(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

Version history

  • Added in version 2.0.9.
  • Parameter start_index since version 2.1.1.
  • Changed to consume input adapters, removed start_index parameter, and added strict parameter in version 3.0.0.
  • Added allow_exceptions parameter in version 3.2.0.
  • Added tag_handler parameter in version 3.9.0.

Deprecation

  • Overload (2) replaces calls to from_cbor with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_cbor(ptr, len, ...); with from_cbor(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_cbor with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_cbor({ptr, ptr+len}, ...); with from_cbor(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/from_msgpack/index.html b/api/basic_json/from_msgpack/index.html index 80d05a513..e2ffddb4b 100644 --- a/api/basic_json/from_msgpack/index.html +++ b/api/basic_json/from_msgpack/index.html @@ -1,4 +1,4 @@ - from_msgpack - JSON for Modern C++
Skip to content

nlohmann::basic_json::from_msgpack

// (1)
+ from_msgpack - JSON for Modern C++      

nlohmann::basic_json::from_msgpack

// (1)
 template<typename InputType>
 static basic_json from_msgpack(InputType&& i,
                                const bool strict = true,
@@ -32,4 +32,4 @@
   "compact": true,
   "schema": 0
 }
-

Version history

  • Added in version 2.0.9.
  • Parameter start_index since version 2.1.1.
  • Changed to consume input adapters, removed start_index parameter, and added strict parameter in version 3.0.0.
  • Added allow_exceptions parameter in version 3.2.0.

Deprecation

  • Overload (2) replaces calls to from_msgpack with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_msgpack(ptr, len, ...); with from_msgpack(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_cbor with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_msgpack({ptr, ptr+len}, ...); with from_msgpack(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

Version history

  • Added in version 2.0.9.
  • Parameter start_index since version 2.1.1.
  • Changed to consume input adapters, removed start_index parameter, and added strict parameter in version 3.0.0.
  • Added allow_exceptions parameter in version 3.2.0.

Deprecation

  • Overload (2) replaces calls to from_msgpack with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_msgpack(ptr, len, ...); with from_msgpack(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_cbor with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_msgpack({ptr, ptr+len}, ...); with from_msgpack(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/from_ubjson/index.html b/api/basic_json/from_ubjson/index.html index 7b05172db..7eba0c9d7 100644 --- a/api/basic_json/from_ubjson/index.html +++ b/api/basic_json/from_ubjson/index.html @@ -1,4 +1,4 @@ - from_ubjson - JSON for Modern C++
Skip to content

nlohmann::basic_json::from_ubjson

// (1)
+ from_ubjson - JSON for Modern C++      

nlohmann::basic_json::from_ubjson

// (1)
 template<typename InputType>
 static basic_json from_ubjson(InputType&& i,
                               const bool strict = true,
@@ -32,4 +32,4 @@
   "compact": true,
   "schema": 0
 }
-

Version history

  • Added in version 3.1.0.
  • Added allow_exceptions parameter in version 3.2.0.

Deprecation

  • Overload (2) replaces calls to from_ubjson with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_ubjson(ptr, len, ...); with from_ubjson(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_ubjson with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_ubjson({ptr, ptr+len}, ...); with from_ubjson(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

Version history

  • Added in version 3.1.0.
  • Added allow_exceptions parameter in version 3.2.0.

Deprecation

  • Overload (2) replaces calls to from_ubjson with a pointer and a length as first two parameters, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_ubjson(ptr, len, ...); with from_ubjson(ptr, ptr+len, ...);.
  • Overload (2) replaces calls to from_ubjson with a pair of iterators as their first parameter, which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like from_ubjson({ptr, ptr+len}, ...); with from_ubjson(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/front/index.html b/api/basic_json/front/index.html index e331fe5d3..7eb2ed17d 100644 --- a/api/basic_json/front/index.html +++ b/api/basic_json/front/index.html @@ -1,4 +1,4 @@ - front - JSON for Modern C++
Skip to content

nlohmann::basic_json::front

reference front();
+ front - JSON for Modern C++      

nlohmann::basic_json::front

reference front();
 const_reference front() const;
 

Returns a reference to the first element in the container. For a JSON container c, the expression c.front() is equivalent to *c.begin().

Return value

In case of a structured type (array or object), a reference to the first element is returned. In case of number, string, boolean, or binary values, a reference to the value is returned.

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the JSON value.

Exceptions

If the JSON value is null, exception invalid_iterator.214 is thrown.

Complexity

Constant.

Notes

Precondition

The array or object must not be empty. Calling front on an empty array or object yields undefined behavior.

Examples

Example

The following code shows an example for front().

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -35,4 +35,4 @@
 1
 1
 "Hello, world"
-

See also

  • back to access the last element

Version history

  • Added in version 1.0.0.
  • Adjusted code to return reference to binary values in version 3.8.0.
\ No newline at end of file +

See also

  • back to access the last element

Version history

  • Added in version 1.0.0.
  • Adjusted code to return reference to binary values in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/get/index.html b/api/basic_json/get/index.html index 7afe31382..e70c30d24 100644 --- a/api/basic_json/get/index.html +++ b/api/basic_json/get/index.html @@ -1,4 +1,4 @@ - get - JSON for Modern C++
Skip to content

nlohmann::basic_json::get

// (1)
+ get - JSON for Modern C++      

nlohmann::basic_json::get

// (1)
 template<typename ValueType>
 ValueType get() const noexcept(
     noexcept(JSONSerializer<ValueType>::from_json(
@@ -103,4 +103,4 @@
 }
 

Output:

17 17 17 17
 true
-

Version history

  1. Since version 2.1.0.
  2. Since version 2.1.0. Extended to work with other specializations of basic_json in version 3.2.0.
  3. Since version 1.0.0.
\ No newline at end of file +

Version history

  1. Since version 2.1.0.
  2. Since version 2.1.0. Extended to work with other specializations of basic_json in version 3.2.0.
  3. Since version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/get_allocator/index.html b/api/basic_json/get_allocator/index.html index 82e5b30f2..4c3a6350e 100644 --- a/api/basic_json/get_allocator/index.html +++ b/api/basic_json/get_allocator/index.html @@ -1,4 +1,4 @@ - get_allocator - JSON for Modern C++
Skip to content

nlohmann::basic_json::get_allocator

static allocator_type get_allocator();
+ get_allocator - JSON for Modern C++      

nlohmann::basic_json::get_allocator

static allocator_type get_allocator();
 

Returns the allocator associated with the container.

Return value

associated allocator

Examples

Example

The example shows how get_allocator() is used to created json values.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -18,4 +18,4 @@
     traits_t::deallocate(alloc, j, 1);
 }
 

Output:

"Hello, world!"
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/get_binary/index.html b/api/basic_json/get_binary/index.html index ae9ff4788..a6138601e 100644 --- a/api/basic_json/get_binary/index.html +++ b/api/basic_json/get_binary/index.html @@ -1,4 +1,4 @@ - get_binary - JSON for Modern C++
Skip to content

nlohmann::basic_json::get_binary

binary_t& get_binary();
+ get_binary - JSON for Modern C++      

nlohmann::basic_json::get_binary

binary_t& get_binary();
 
 const binary_t& get_binary() const;
 

Returns a reference to the stored binary value.

Return value

Reference to binary value.

Exception safety

Strong exception safety: if an exception occurs, the original value stays intact.

Exceptions

Throws type_error.302 if the value is not binary

Complexity

Constant.

Examples

Example

The following code shows how to query a binary value.

#include <iostream>
@@ -18,4 +18,4 @@
     std::cout << "type: " << j.type_name() << ", subtype: " << j.get_binary().subtype() << std::endl;
 }
 

Output:

type: binary, subtype: 42
-

Version history

  • Added in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/get_ptr/index.html b/api/basic_json/get_ptr/index.html index 1fb6526c2..cceb509d9 100644 --- a/api/basic_json/get_ptr/index.html +++ b/api/basic_json/get_ptr/index.html @@ -1,4 +1,4 @@ - get_ptr - JSON for Modern C++
Skip to content

nlohmann::basic_json::get_ptr

template<typename PointerType>
+ get_ptr - JSON for Modern C++      

nlohmann::basic_json::get_ptr

template<typename PointerType>
 PointerType get_ptr() noexcept;
 
 template<typename PointerType>
@@ -44,4 +44,4 @@ value at 0x6000029fc088 is 1
 }
 

Output:

17 17 17 17
 true
-

See also

Version history

  • Added in version 1.0.0.
  • Extended to binary types in version 3.8.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
  • Extended to binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/get_ref/index.html b/api/basic_json/get_ref/index.html index d0b311148..9cdd059bd 100644 --- a/api/basic_json/get_ref/index.html +++ b/api/basic_json/get_ref/index.html @@ -1,4 +1,4 @@ - get_ref - JSON for Modern C++
Skip to content

nlohmann::basic_json::get_ref

template<typename ReferenceType>
+ get_ref - JSON for Modern C++      

nlohmann::basic_json::get_ref

template<typename ReferenceType>
 ReferenceType get_ref();
 
 template<typename ReferenceType>
@@ -32,4 +32,4 @@
 }
 

Output:

17 17
 [json.exception.type_error.303] incompatible ReferenceType for get_ref, actual type is number
-

See also

Version history

  • Added in version 1.1.0.
  • Extended to binary types in version 3.8.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.1.0.
  • Extended to binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/get_to/index.html b/api/basic_json/get_to/index.html index e252213c6..2fc23efd2 100644 --- a/api/basic_json/get_to/index.html +++ b/api/basic_json/get_to/index.html @@ -1,4 +1,4 @@ - get_to - JSON for Modern C++
Skip to content

nlohmann::basic_json::get_to

template<typename ValueType>
+ get_to - JSON for Modern C++      

nlohmann::basic_json::get_to

template<typename ValueType>
 ValueType& get_to(ValueType& v) const noexcept(
     noexcept(JSONSerializer<ValueType>::from_json(
         std::declval<const basic_json_t&>(), v)));
@@ -74,4 +74,4 @@
 null: null
 boolean: true
 array: [1,2,3,4,5]
-

Version history

  • Since version 3.3.0.
\ No newline at end of file +

Version history

  • Since version 3.3.0.
\ No newline at end of file diff --git a/api/basic_json/index.html b/api/basic_json/index.html index c0a2ac581..5d5cf84ff 100644 --- a/api/basic_json/index.html +++ b/api/basic_json/index.html @@ -1,4 +1,4 @@ - Overview - JSON for Modern C++
Skip to content

nlohmann::basic_json

Defined in header <nlohmann/json.hpp>

template<
+ Overview - JSON for Modern C++      

nlohmann::basic_json

Defined in header <nlohmann/json.hpp>

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,
@@ -78,4 +78,4 @@
     "pi": 3.141,
     "size": 8
 }
-

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/input_format_t/index.html b/api/basic_json/input_format_t/index.html index 53b52933e..3d62f1a4d 100644 --- a/api/basic_json/input_format_t/index.html +++ b/api/basic_json/input_format_t/index.html @@ -1,4 +1,4 @@ - input_format_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::input_format_t

enum class input_format_t {
+ input_format_t - JSON for Modern C++      

nlohmann::basic_json::input_format_t

enum class input_format_t {
     json,
     cbor,
     msgpack,
@@ -123,4 +123,4 @@
 

Output:

binary(val=[...])
 
 result: true
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/basic_json/insert/index.html b/api/basic_json/insert/index.html index 1b8d2bfb1..631fc7c2e 100644 --- a/api/basic_json/insert/index.html +++ b/api/basic_json/insert/index.html @@ -1,4 +1,4 @@ - insert - JSON for Modern C++
Skip to content

nlohmann::basic_json::insert

// (1)
+ insert - JSON for Modern C++      

nlohmann::basic_json::insert

// (1)
 iterator insert(const_iterator pos, const basic_json& val);
 iterator insert(const_iterator pos, basic_json&& val);
 
@@ -116,4 +116,4 @@
 

Output:

{"one":"eins","two":"zwei"}
 {"eleven":"elf","seventeen":"siebzehn"}
 {"eleven":"elf","one":"eins","seventeen":"siebzehn","two":"zwei"}
-

Version history

  1. Added in version 1.0.0.
  2. Added in version 1.0.0.
  3. Added in version 1.0.0.
  4. Added in version 1.0.0.
  5. Added in version 3.0.0.
\ No newline at end of file +

Version history

  1. Added in version 1.0.0.
  2. Added in version 1.0.0.
  3. Added in version 1.0.0.
  4. Added in version 1.0.0.
  5. Added in version 3.0.0.
\ No newline at end of file diff --git a/api/basic_json/invalid_iterator/index.html b/api/basic_json/invalid_iterator/index.html index 39245ee6d..cea6b3939 100644 --- a/api/basic_json/invalid_iterator/index.html +++ b/api/basic_json/invalid_iterator/index.html @@ -1,4 +1,4 @@ - invalid_iterator - JSON for Modern C++
Skip to content

nlohmann::basic_json::invalid_iterator

class invalid_iterator : public exception;
+ invalid_iterator - JSON for Modern C++      

nlohmann::basic_json::invalid_iterator

class invalid_iterator : public exception;
 

This exception is thrown if iterators passed to a library function do not match the expected semantics.

Exceptions have ids 2xx (see list of iterator errors).

classDiagram
   direction LR
 
@@ -50,4 +50,4 @@
 }
 

Output:

message: [json.exception.invalid_iterator.207] cannot use key() for non-object iterators
 exception id: 207
-

See also

Version history

  • Since version 3.0.0.
\ No newline at end of file +

See also

Version history

\ No newline at end of file diff --git a/api/basic_json/is_array/index.html b/api/basic_json/is_array/index.html index 0630411ca..3d114521e 100644 --- a/api/basic_json/is_array/index.html +++ b/api/basic_json/is_array/index.html @@ -1,4 +1,4 @@ - is_array - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_array

constexpr bool is_array() const noexcept;
+ is_array - JSON for Modern C++      

nlohmann::basic_json::is_array

constexpr bool is_array() const noexcept;
 

This function returns true if and only if the JSON value is an array.

Return value

true if type is an array, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_array() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 true
 false
 false
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_binary/index.html b/api/basic_json/is_binary/index.html index 6902c47e4..2b01c2c7d 100644 --- a/api/basic_json/is_binary/index.html +++ b/api/basic_json/is_binary/index.html @@ -1,4 +1,4 @@ - is_binary - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_binary

constexpr bool is_binary() const noexcept;
+ is_binary - JSON for Modern C++      

nlohmann::basic_json::is_binary

constexpr bool is_binary() const noexcept;
 

This function returns true if and only if the JSON value is binary array.

Return value

true if type is binary, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_binary() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 true
-

Version history

  • Added in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/is_boolean/index.html b/api/basic_json/is_boolean/index.html index 8a81b6fef..d7ba260bb 100644 --- a/api/basic_json/is_boolean/index.html +++ b/api/basic_json/is_boolean/index.html @@ -1,4 +1,4 @@ - is_boolean - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_boolean

constexpr bool is_boolean() const noexcept;
+ is_boolean - JSON for Modern C++      

nlohmann::basic_json::is_boolean

constexpr bool is_boolean() const noexcept;
 

This function returns true if and only if the JSON value is true or false.

Return value

true if type is boolean, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_boolean() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 false
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_discarded/index.html b/api/basic_json/is_discarded/index.html index 2940fde9e..bb37b3ac5 100644 --- a/api/basic_json/is_discarded/index.html +++ b/api/basic_json/is_discarded/index.html @@ -1,4 +1,4 @@ - is_discarded - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_discarded

constexpr bool is_discarded() const noexcept;
+ is_discarded - JSON for Modern C++      

nlohmann::basic_json::is_discarded

constexpr bool is_discarded() const noexcept;
 

This function returns true for a JSON value if either:

  • the value was discarded during parsing with a callback function (see parser_callback_t), or
  • the value is the result of parsing invalid JSON with parameter allow_exceptions set to false; see parse for more information.

Return value

true if type is discarded, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Notes

Comparisons

Discarded values are never compared equal with operator==. That is, checking whether a JSON value j is discarded will only work via:

j.is_discarded()
 

because

j == json::value_t::discarded
 

will always be false.

Removal during parsing with callback functions

When a value is discarded by a callback function (see parser_callback_t) during parsing, then it is removed when it is part of a structured value. For instance, if the second value of an array is discarded, instead of [null, discarded, false], the array [null, false] is returned. Only if the top-level value is discarded, the return value of the parse call is discarded.

This function will always be false for JSON values after parsing. That is, discarded values can only occur during parsing, but will be removed when inside a structured value or replaced by null in other cases.

Examples

Example

The following code exemplifies is_discarded() for all JSON types.

#include <iostream>
@@ -40,4 +40,4 @@
 false
 false
 false
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_null/index.html b/api/basic_json/is_null/index.html index 9e3589816..fe9448fd9 100644 --- a/api/basic_json/is_null/index.html +++ b/api/basic_json/is_null/index.html @@ -1,4 +1,4 @@ - is_null - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_null

constexpr bool is_null() const noexcept;
+ is_null - JSON for Modern C++      

nlohmann::basic_json::is_null

constexpr bool is_null() const noexcept;
 

This function returns true if and only if the JSON value is null.

Return value

true if type is null, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_null() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 false
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_number/index.html b/api/basic_json/is_number/index.html index 1b485327d..c5b553d5a 100644 --- a/api/basic_json/is_number/index.html +++ b/api/basic_json/is_number/index.html @@ -1,4 +1,4 @@ - is_number - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_number

constexpr bool is_number() const noexcept;
+ is_number - JSON for Modern C++      

nlohmann::basic_json::is_number

constexpr bool is_number() const noexcept;
 

This function returns true if and only if the JSON value is a number. This includes both integer (signed and unsigned) and floating-point values.

Return value

true if type is number (regardless whether integer, unsigned integer or floating-type), false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Possible implementation

constexpr bool is_number() const noexcept
 {
     return is_number_integer() || is_number_float();
@@ -42,4 +42,4 @@
 false
 false
 false
-

See also

Version history

  • Added in version 1.0.0.
  • Extended to also return true for unsigned integers in 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
  • Extended to also return true for unsigned integers in 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_number_float/index.html b/api/basic_json/is_number_float/index.html index d61b6ad72..ac48a0d98 100644 --- a/api/basic_json/is_number_float/index.html +++ b/api/basic_json/is_number_float/index.html @@ -1,4 +1,4 @@ - is_number_float - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_number_float

constexpr bool is_number_float() const noexcept;
+ is_number_float - JSON for Modern C++      

nlohmann::basic_json::is_number_float

constexpr bool is_number_float() const noexcept;
 

This function returns true if and only if the JSON value is a floating-point number. This excludes signed and unsigned integer values.

Return value

true if type is a floating-point number, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_number_float() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 false
-

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_number_integer/index.html b/api/basic_json/is_number_integer/index.html index fdb39bbf9..7d051219e 100644 --- a/api/basic_json/is_number_integer/index.html +++ b/api/basic_json/is_number_integer/index.html @@ -1,4 +1,4 @@ - is_number_integer - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_number_integer

constexpr bool is_number_integer() const noexcept;
+ is_number_integer - JSON for Modern C++      

nlohmann::basic_json::is_number_integer

constexpr bool is_number_integer() const noexcept;
 

This function returns true if and only if the JSON value is a signed or unsigned integer number. This excludes floating-point values.

Return value

true if type is an integer or unsigned integer number, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_number_integer() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 false
-

See also

Version history

  • Added in version 1.0.0.
  • Extended to also return true for unsigned integers in 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
  • Extended to also return true for unsigned integers in 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_number_unsigned/index.html b/api/basic_json/is_number_unsigned/index.html index 6daa4df75..8119155a4 100644 --- a/api/basic_json/is_number_unsigned/index.html +++ b/api/basic_json/is_number_unsigned/index.html @@ -1,4 +1,4 @@ - is_number_unsigned - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_number_unsigned

constexpr bool is_number_unsigned() const noexcept;
+ is_number_unsigned - JSON for Modern C++      

nlohmann::basic_json::is_number_unsigned

constexpr bool is_number_unsigned() const noexcept;
 

This function returns true if and only if the JSON value is an unsigned integer number. This excludes floating-point and signed integer values.

Return value

true if type is an unsigned integer number, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_number_unsigned() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 false
-

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_object/index.html b/api/basic_json/is_object/index.html index 1cb3a9c89..f1412900d 100644 --- a/api/basic_json/is_object/index.html +++ b/api/basic_json/is_object/index.html @@ -1,4 +1,4 @@ - is_object - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_object

constexpr bool is_object() const noexcept;
+ is_object - JSON for Modern C++      

nlohmann::basic_json::is_object

constexpr bool is_object() const noexcept;
 

This function returns true if and only if the JSON value is an object.

Return value

true if type is an object, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_object() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 false
 false
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_primitive/index.html b/api/basic_json/is_primitive/index.html index 0c05c2494..57a57a33c 100644 --- a/api/basic_json/is_primitive/index.html +++ b/api/basic_json/is_primitive/index.html @@ -1,4 +1,4 @@ - is_primitive - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_primitive

constexpr bool is_primitive() const noexcept;
+ is_primitive - JSON for Modern C++      

nlohmann::basic_json::is_primitive

constexpr bool is_primitive() const noexcept;
 

This function returns true if and only if the JSON type is primitive (string, number, boolean, null, binary).

Return value

true if type is primitive (string, number, boolean, null, or binary), false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Possible implementation

constexpr bool is_primitive() const noexcept
 {
     return is_null() || is_string() || is_boolean() || is_number() || is_binary();
@@ -42,4 +42,4 @@
 false
 true
 true
-

See also

Version history

  • Added in version 1.0.0.
  • Extended to return true for binary types in version 3.8.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
  • Extended to return true for binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/is_string/index.html b/api/basic_json/is_string/index.html index ee2f0b09e..e13d67b3e 100644 --- a/api/basic_json/is_string/index.html +++ b/api/basic_json/is_string/index.html @@ -1,4 +1,4 @@ - is_string - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_string

constexpr bool is_string() const noexcept;
+ is_string - JSON for Modern C++      

nlohmann::basic_json::is_string

constexpr bool is_string() const noexcept;
 

This function returns true if and only if the JSON value is a string.

Return value

true if type is a string, false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies is_string() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -38,4 +38,4 @@
 false
 true
 false
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/is_structured/index.html b/api/basic_json/is_structured/index.html index 1e985cf3e..1a5c00230 100644 --- a/api/basic_json/is_structured/index.html +++ b/api/basic_json/is_structured/index.html @@ -1,4 +1,4 @@ - is_structured - JSON for Modern C++
Skip to content

nlohmann::basic_json::is_structured

constexpr bool is_structured() const noexcept;
+ is_structured - JSON for Modern C++      

nlohmann::basic_json::is_structured

constexpr bool is_structured() const noexcept;
 

This function returns true if and only if the JSON type is structured (array or object).

Return value

true if type is structured (array or object), false otherwise.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Possible implementation

constexpr bool is_structured() const noexcept
 {
     return is_array() || is_object();
@@ -42,4 +42,4 @@
 true
 false
 false
-

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/items/index.html b/api/basic_json/items/index.html index 676d7ef35..52118dea2 100644 --- a/api/basic_json/items/index.html +++ b/api/basic_json/items/index.html @@ -1,4 +1,4 @@ - items - JSON for Modern C++
Skip to content

nlohmann::basic_json::items

iteration_proxy<iterator> items() noexcept;
+ items - JSON for Modern C++      

nlohmann::basic_json::items

iteration_proxy<iterator> items() noexcept;
 iteration_proxy<const_iterator> items() const noexcept;
 

This function allows accessing iterator::key() and iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.

For loop without items() function:

for (auto it = j_object.begin(); it != j_object.end(); ++it)
 {
@@ -47,4 +47,4 @@
 key: 2, value: 4
 key: 3, value: 8
 key: 4, value: 16
-

Version history

  • Added iterator_wrapper in version 3.0.0.
  • Added items and deprecated iterator_wrapper in version 3.1.0.
  • Added structured binding support in version 3.5.0.

Deprecation

This function replaces the static function iterator_wrapper which was introduced in version 1.0.0, but has been deprecated in version 3.1.0. Function iterator_wrapper will be removed in version 4.0.0. Please replace all occurrences of iterator_wrapper(j) with j.items().

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

Version history

  • Added iterator_wrapper in version 3.0.0.
  • Added items and deprecated iterator_wrapper in version 3.1.0.
  • Added structured binding support in version 3.5.0.

Deprecation

This function replaces the static function iterator_wrapper which was introduced in version 1.0.0, but has been deprecated in version 3.1.0. Function iterator_wrapper will be removed in version 4.0.0. Please replace all occurrences of iterator_wrapper(j) with j.items().

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/json_base_class_t/index.html b/api/basic_json/json_base_class_t/index.html index d8f6fe55e..2ce4c2ee6 100644 --- a/api/basic_json/json_base_class_t/index.html +++ b/api/basic_json/json_base_class_t/index.html @@ -1,4 +1,4 @@ - json_base_class_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::json_base_class_t

using json_base_class_t = detail::json_base_class<CustomBaseClass>;
+ json_base_class_t - JSON for Modern C++      

nlohmann::basic_json::json_base_class_t

using json_base_class_t = detail::json_base_class<CustomBaseClass>;
 

The base class used to inject custom functionality into each instance of basic_json. Examples of such functionality might be metadata, additional member functions (e.g., visitors), or other application-specific code.

Template parameters

CustomBaseClass
the base class to be added to basic_json

Notes

Default type

The default value for CustomBaseClass is void. In this case an empty base class is used and no additional functionality is injected.

Limitations

The type CustomBaseClass has to be a default-constructible class. basic_json only supports copy/move construction/assignment if CustomBaseClass does so as well.

Examples

Example

The following code shows how to inject custom data and methods for each node.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -91,4 +91,4 @@
 /null - metadata = 42 -> null
 /object - metadata = 21 -> {"uint":1}
 /object/uint - metadata = 42 -> 1
-

Version history

  • Added in version 3.12.0.
\ No newline at end of file +

Version history

  • Added in version 3.12.0.
\ No newline at end of file diff --git a/api/basic_json/json_serializer/index.html b/api/basic_json/json_serializer/index.html index 3d839da74..d65acae6b 100644 --- a/api/basic_json/json_serializer/index.html +++ b/api/basic_json/json_serializer/index.html @@ -1,4 +1,4 @@ - json_serializer - JSON for Modern C++
Skip to content

nlohmann::basic_json::json_serializer

template<typename T, typename SFINAE>
+ json_serializer - JSON for Modern C++      

nlohmann::basic_json::json_serializer

template<typename T, typename SFINAE>
 using json_serializer = JSONSerializer<T, SFINAE>;
 

Template parameters

T
type to convert; will be used in the to_json/from_json functions
SFINAE
type to add compile type checks via SFINAE; usually void

Notes

Default type

The default values for json_serializer is adl_serializer.

Examples

Example

The example below shows how a conversion of a non-default-constructible type is implemented via a specialization of the adl_serializer.

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -54,4 +54,4 @@
     std::cout << p.name << " (" << p.age << ") lives in " << p.address << std::endl;
 }
 

Output:

Ned Flanders (60) lives in 744 Evergreen Terrace
-

Version history

  • Since version 2.0.0.
\ No newline at end of file +

Version history

  • Since version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/max_size/index.html b/api/basic_json/max_size/index.html index 06f286701..6c99d38c7 100644 --- a/api/basic_json/max_size/index.html +++ b/api/basic_json/max_size/index.html @@ -1,4 +1,4 @@ - max_size - JSON for Modern C++
Skip to content

nlohmann::basic_json::max_size

size_type max_size() const noexcept;
+ max_size - JSON for Modern C++      

nlohmann::basic_json::max_size

size_type max_size() const noexcept;
 

Returns the maximum number of elements a JSON value is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the JSON value.

Return value

The return value depends on the different types and is defined as follows:

Value type return value
null 0 (same as size())
boolean 1 (same as size())
string 1 (same as size())
number 1 (same as size())
binary 1 (same as size())
object result of function object_t::max_size()
array result of function array_t::max_size()

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant, as long as array_t and object_t satisfy the Container concept; that is, their max_size() functions have constant complexity.

Notes

This function does not return the maximal length of a string stored as JSON value -- it returns the maximal number of string elements the JSON value can store which is 1.

Examples

Example

The following code calls max_size() on the different value types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -31,4 +31,4 @@
 115292150460684697
 576460752303423487
 1
-

Note the output is platform-dependent.

Version history

  • Added in version 1.0.0.
  • Extended to return 1 for binary types in version 3.8.0.
\ No newline at end of file +

Note the output is platform-dependent.

Version history

  • Added in version 1.0.0.
  • Extended to return 1 for binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/merge_patch/index.html b/api/basic_json/merge_patch/index.html index ac107d49d..5045e3f0f 100644 --- a/api/basic_json/merge_patch/index.html +++ b/api/basic_json/merge_patch/index.html @@ -1,4 +1,4 @@ - merge_patch - JSON for Modern C++
Skip to content

nlohmann::basic_json::merge_patch

void merge_patch(const basic_json& apply_patch);
+ merge_patch - JSON for Modern C++      

nlohmann::basic_json::merge_patch

void merge_patch(const basic_json& apply_patch);
 

The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value.

The function implements the following algorithm from Section 2 of RFC 7396 (JSON Merge Patch):

define MergePatch(Target, Patch):
   if Patch is an Object:
     if Target is not an Object:
@@ -64,4 +64,4 @@
     ],
     "title": "Hello!"
 }
-

See also

Version history

  • Added in version 3.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.0.0.
\ No newline at end of file diff --git a/api/basic_json/meta/index.html b/api/basic_json/meta/index.html index e85d3c09f..c4a744da7 100644 --- a/api/basic_json/meta/index.html +++ b/api/basic_json/meta/index.html @@ -1,4 +1,4 @@ - meta - JSON for Modern C++
Skip to content

nlohmann::basic_json::meta

static basic_json meta();
+ meta - JSON for Modern C++      

nlohmann::basic_json::meta

static basic_json meta();
 

This function returns a JSON object with information about the library, including the version number and information on the platform and compiler.

Return value

JSON object holding version information

key description
compiler Information on the used compiler. It is an object with the following keys: c++ (the used C++ standard), family (the compiler family; possible values are clang, icc, gcc, ilecpp, msvc, pgcpp, sunpro, and unknown), and version (the compiler version).
copyright The copyright line for the library as string.
name The name of the library as string.
platform The used platform as string. Possible values are win32, linux, apple, unix, and unknown.
url The URL of the project as string.
version The version of the library. It is an object with the following keys: major, minor, and patch as defined by Semantic Versioning, and string (the version string).

Exception safety

Strong guarantee: if an exception is thrown, there are no changes to any JSON value.

Complexity

Constant.

Examples

Example

The following code shows an example output of the meta() function.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -27,4 +27,4 @@
         "string": "3.11.3"
     }
 }
-

Note the output is platform-dependent.

See also

Version history

  • Added in version 2.1.0.
\ No newline at end of file +

Note the output is platform-dependent.

See also

Version history

  • Added in version 2.1.0.
\ No newline at end of file diff --git a/api/basic_json/number_float_t/index.html b/api/basic_json/number_float_t/index.html index 883fad999..8df714e58 100644 --- a/api/basic_json/number_float_t/index.html +++ b/api/basic_json/number_float_t/index.html @@ -1,4 +1,4 @@ - number_float_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::number_float_t

using number_float_t = NumberFloatType;
+ number_float_t - JSON for Modern C++      

nlohmann::basic_json::number_float_t

using number_float_t = NumberFloatType;
 

The type used to store JSON numbers (floating-point).

RFC 8259 describes numbers as follows:

The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.

This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, number_integer_t, number_unsigned_t and number_float_t are used.

To store floating-point numbers in C++, a type is defined by the template parameter NumberFloatType which chooses the type to use.

Notes

Default type

With the default values for NumberFloatType (double), the default value for number_float_t is double.

Default behavior

  • The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in floating-point literals will be ignored. Internally, the value will be stored as decimal number. For instance, the C++ floating-point literal 01.2 will be serialized to 1.2. During deserialization, leading zeros yield an error.
  • Not-a-number (NaN) values will be serialized to null.

Limits

RFC 8259 states:

This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754-2008 binary64 (double precision) numbers is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision.

This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than -1.79769313486232e+308 and values greater than 1.79769313486232e+308 will be stored as NaN internally and be serialized to null.

Storage

Floating-point number values are stored directly inside a basic_json type.

Examples

Example

The following code shows that number_float_t is by default, a typedef to double.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -10,4 +10,4 @@
     std::cout << std::boolalpha << std::is_same<double, json::number_float_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/number_integer_t/index.html b/api/basic_json/number_integer_t/index.html index df259841b..dd2787a7b 100644 --- a/api/basic_json/number_integer_t/index.html +++ b/api/basic_json/number_integer_t/index.html @@ -1,4 +1,4 @@ - number_integer_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::number_integer_t

using number_integer_t = NumberIntegerType;
+ number_integer_t - JSON for Modern C++      

nlohmann::basic_json::number_integer_t

using number_integer_t = NumberIntegerType;
 

The type used to store JSON numbers (integers).

RFC 8259 describes numbers as follows:

The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.

This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, number_integer_t, number_unsigned_t and number_float_t are used.

To store integer numbers in C++, a type is defined by the template parameter NumberIntegerType which chooses the type to use.

Notes

Default type

With the default values for NumberIntegerType (std::int64_t), the default value for number_integer_t is std::int64_t.

Default behavior

  • The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal 010 will be serialized to 8. During deserialization, leading zeros yield an error.
  • Not-a-number (NaN) values will be serialized to null.

Limits

RFC 8259 specifies:

An implementation may set limits on the range and precision of numbers.

When the default type is used, the maximal integer number that can be stored is 9223372036854775807 (INT64_MAX) and the minimal integer number that can be stored is -9223372036854775808 (INT64_MIN). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as number_unsigned_t or number_float_t.

RFC 8259 further states:

Note that when such software is used, numbers that are integers and are in the range [-2^{53}+1, 2^{53}-1] are interoperable in the sense that implementations will agree exactly on their numeric values.

As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is interoperable.

Storage

Integer number values are stored directly inside a basic_json type.

Examples

Example

The following code shows that number_integer_t is by default, a typedef to std::int64_t.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -10,4 +10,4 @@
     std::cout << std::boolalpha << std::is_same<std::int64_t, json::number_integer_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/number_unsigned_t/index.html b/api/basic_json/number_unsigned_t/index.html index f91d81a01..d05c49c60 100644 --- a/api/basic_json/number_unsigned_t/index.html +++ b/api/basic_json/number_unsigned_t/index.html @@ -1,4 +1,4 @@ - number_unsigned_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::number_unsigned_t

using number_unsigned_t = NumberUnsignedType;
+ number_unsigned_t - JSON for Modern C++      

nlohmann::basic_json::number_unsigned_t

using number_unsigned_t = NumberUnsignedType;
 

The type used to store JSON numbers (unsigned).

RFC 8259 describes numbers as follows:

The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.

This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, number_integer_t, number_unsigned_t and number_float_t are used.

To store unsigned integer numbers in C++, a type is defined by the template parameter NumberUnsignedType which chooses the type to use.

Notes

Default type

With the default values for NumberUnsignedType (std::uint64_t), the default value for number_unsigned_t is std::uint64_t.

Default behavior

  • The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal 010 will be serialized to 8. During deserialization, leading zeros yield an error.
  • Not-a-number (NaN) values will be serialized to null.

Limits

RFC 8259 specifies:

An implementation may set limits on the range and precision of numbers.

When the default type is used, the maximal integer number that can be stored is 18446744073709551615 (UINT64_MAX) and the minimal integer number that can be stored is 0. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as number_integer_t or number_float_t.

RFC 8259 further states:

Note that when such software is used, numbers that are integers and are in the range \f[-2^{53}+1, 2^{53}-1]\f are interoperable in the sense that implementations will agree exactly on their numeric values.

As this range is a subrange (when considered in conjunction with the number_integer_t type) of the exactly supported range [0, UINT64_MAX], this class's integer type is interoperable.

Storage

Integer number values are stored directly inside a basic_json type.

Examples

Example

The following code shows that number_unsigned_t is by default, a typedef to std::uint64_t.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -10,4 +10,4 @@
     std::cout << std::boolalpha << std::is_same<std::uint64_t, json::number_unsigned_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 2.0.0.
\ No newline at end of file +

Version history

  • Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/object/index.html b/api/basic_json/object/index.html index 6849102c9..0f09868f1 100644 --- a/api/basic_json/object/index.html +++ b/api/basic_json/object/index.html @@ -1,4 +1,4 @@ - object - JSON for Modern C++
Skip to content

nlohmann::basic_json::object

static basic_json object(initializer_list_t init = {});
+ object - JSON for Modern C++      

nlohmann::basic_json::object

static basic_json object(initializer_list_t init = {});
 

Creates a JSON object value from a given initializer list. The initializer lists elements must be pairs, and their first elements must be strings. If the initializer list is empty, the empty object {} is created.

Parameters

init (in)
initializer list with JSON values to create an object from (optional)

Return value

JSON object value

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the JSON value.

Exceptions

Throws type_error.301 if init is not a list of pairs whose first elements are strings. In this case, no object can be created. When such a value is passed to basic_json(initializer_list_t, bool, value_t), an array would have been created from the passed initializer list init. See example below.

Complexity

Linear in the size of init.

Notes

This function is only added for symmetry reasons. In contrast to the related function array(initializer_list_t), there are no cases which can only be expressed by this function. That is, any initializer list init can also be passed to the initializer list constructor basic_json(initializer_list_t, bool, value_t).

Examples

Example

The following code shows an example for the object function.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -31,4 +31,4 @@
 {}
 {"one":1,"two":2}
 [json.exception.type_error.301] cannot create object from initializer list
-

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/object_comparator_t/index.html b/api/basic_json/object_comparator_t/index.html index 8252253ec..b603b30bf 100644 --- a/api/basic_json/object_comparator_t/index.html +++ b/api/basic_json/object_comparator_t/index.html @@ -1,4 +1,4 @@ - object_comparator_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::object_comparator_t

using object_comparator_t = typename object_t::key_compare;
+ object_comparator_t - JSON for Modern C++      

nlohmann::basic_json::object_comparator_t

using object_comparator_t = typename object_t::key_compare;
 // or
 using object_comparator_t = default_object_comparator_t;
 

The comparator used by object_t. Defined as typename object_t::key_compare if available, and default_object_comparator_t otherwise.

Examples

Example

The example below demonstrates the used object comparator.

#include <iostream>
@@ -14,4 +14,4 @@
 }
 

Output:

json::object_comparator_t("one", "two") = true
 json::object_comparator_t("three", "four") = false
-

Version history

  • Added in version 3.0.0.
  • Changed to be conditionally defined as typename object_t::key_compare or default_object_comparator_t in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.0.0.
  • Changed to be conditionally defined as typename object_t::key_compare or default_object_comparator_t in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/object_t/index.html b/api/basic_json/object_t/index.html index 331886232..14e31806c 100644 --- a/api/basic_json/object_t/index.html +++ b/api/basic_json/object_t/index.html @@ -1,4 +1,4 @@ - object_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::object_t

using object_t = ObjectType<StringType,
+ object_t - JSON for Modern C++      

nlohmann::basic_json::object_t

using object_t = ObjectType<StringType,
                             basic_json,
                             default_object_comparator_t,
                             AllocatorType<std::pair<const StringType, basic_json>>>;
@@ -28,4 +28,4 @@
     std::cout << std::boolalpha << std::is_same<std::map<json::string_t, json>, json::object_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/operator+=/index.html b/api/basic_json/operator+=/index.html index a9a74a654..b6252887a 100644 --- a/api/basic_json/operator+=/index.html +++ b/api/basic_json/operator+=/index.html @@ -1,4 +1,4 @@ - operator+= - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator+=

// (1)
+ operator+= - JSON for Modern C++      

nlohmann::basic_json::operator+=

// (1)
 reference operator+=(basic_json&& val);
 reference operator+=(const basic_json& val);
 
@@ -96,4 +96,4 @@
 null
 {"four":4,"one":1,"three":3,"two":2}
 [["five",5]]
-

See also

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 2.0.0.
\ No newline at end of file +

See also

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/operator=/index.html b/api/basic_json/operator=/index.html index eabc93ae5..566677e1d 100644 --- a/api/basic_json/operator=/index.html +++ b/api/basic_json/operator=/index.html @@ -1,4 +1,4 @@ - operator= - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator=

basic_json& operator=(basic_json other) noexcept (
+ operator= - JSON for Modern C++      

nlohmann::basic_json::operator=

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 &&
@@ -24,4 +24,4 @@
 }
 

Output:

23
 23
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/operator[]/index.html b/api/basic_json/operator[]/index.html index c0df5fe15..f00ed0b22 100644 --- a/api/basic_json/operator[]/index.html +++ b/api/basic_json/operator[]/index.html @@ -1,4 +1,4 @@ - operator[] - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator[]

// (1)
+ operator[] - JSON for Modern C++      

nlohmann::basic_json::operator[]

// (1)
 reference operator[](size_type idx);
 const_reference operator[](size_type idx) const;
 
@@ -283,4 +283,4 @@
 "foo"
 [1,2]
 2
-

See also

Version history

  1. Added in version 1.0.0.
  2. Added in version 1.0.0. Added overloads for T* key in version 1.1.0. Removed overloads for T* key (replaced by 3) in version 3.11.0.
  3. Added in version 3.11.0.
  4. Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 1.0.0.
  2. Added in version 1.0.0. Added overloads for T* key in version 1.1.0. Removed overloads for T* key (replaced by 3) in version 3.11.0.
  3. Added in version 3.11.0.
  4. Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/operator_ValueType/index.html b/api/basic_json/operator_ValueType/index.html index f10c74e65..808ca553f 100644 --- a/api/basic_json/operator_ValueType/index.html +++ b/api/basic_json/operator_ValueType/index.html @@ -1,4 +1,4 @@ - operator ValueType - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator ValueType

template<typename ValueType>
+ operator ValueType - JSON for Modern C++      

nlohmann::basic_json::operator ValueType

template<typename ValueType>
 JSON_EXPLICIT operator ValueType() const;
 

Implicit type conversion between the JSON value and a compatible value. The call is realized by calling get(). See Notes for the meaning of JSON_EXPLICIT.

Template parameters

ValueType
the value type to return

Return value

copy of the JSON value, converted to ValueType

Exceptions

Depends on what json_serializer<ValueType> from_json() method throws

Complexity

Linear in the size of the JSON value.

Notes

Definition of JSON_EXPLICIT

By default JSON_EXPLICIT is defined to the empty string, so the signature is:

template<typename ValueType>
 operator ValueType() const;
@@ -76,4 +76,4 @@
 boolean: true
 array: [1,2,3,4,5]
 [json.exception.type_error.302] type must be boolean, but is string
-

Version history

\ No newline at end of file +

Version history

\ No newline at end of file diff --git a/api/basic_json/operator_eq/index.html b/api/basic_json/operator_eq/index.html index b6e82b688..eb9248e5d 100644 --- a/api/basic_json/operator_eq/index.html +++ b/api/basic_json/operator_eq/index.html @@ -1,4 +1,4 @@ - operator== - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator==

// until C++20
+ operator== - JSON for Modern C++      

nlohmann::basic_json::operator==

// until C++20
 bool operator==(const_reference lhs, const_reference rhs) noexcept;   // (1)
 
 template<typename ScalarType>
@@ -115,4 +115,4 @@
 17 == nullptr false
 "foo" == nullptr false
 null == nullptr true
-

Version history

  1. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
  2. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
\ No newline at end of file +

Version history

  1. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
  2. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_ge/index.html b/api/basic_json/operator_ge/index.html index ea7f5e4aa..7ae4e87c5 100644 --- a/api/basic_json/operator_ge/index.html +++ b/api/basic_json/operator_ge/index.html @@ -1,4 +1,4 @@ - operator>= - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator>=

// until C++20
+ operator>= - JSON for Modern C++      

nlohmann::basic_json::operator>=

// until C++20
 bool operator>=(const_reference lhs, const_reference rhs) noexcept;   // (1)
 
 template<typename ScalarType>
@@ -34,4 +34,4 @@
 {"A":"a","B":"b"} >= {"A":"a","B":"b"} true
 17 >= 17.0000000000001 false
 "foo" >= "bar" true
-

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_gt/index.html b/api/basic_json/operator_gt/index.html index e97174da2..6cff5ebd2 100644 --- a/api/basic_json/operator_gt/index.html +++ b/api/basic_json/operator_gt/index.html @@ -1,4 +1,4 @@ - operator> - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator>

// until C++20
+ operator> - JSON for Modern C++      

nlohmann::basic_json::operator>

// until C++20
 bool operator>(const_reference lhs, const_reference rhs) noexcept;   // (1)
 
 template<typename ScalarType>
@@ -34,4 +34,4 @@
 {"A":"a","B":"b"} > {"A":"a","B":"b"} false
 17 > 17.0000000000001 false
 "foo" > "bar" true
-

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_le/index.html b/api/basic_json/operator_le/index.html index 9df8d3988..0a2a11570 100644 --- a/api/basic_json/operator_le/index.html +++ b/api/basic_json/operator_le/index.html @@ -1,4 +1,4 @@ - operator<= - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator<=

// until C++20
+ operator<= - JSON for Modern C++      

nlohmann::basic_json::operator<=

// until C++20
 bool operator<=(const_reference lhs, const_reference rhs) noexcept;   // (1)
 
 template<typename ScalarType>
@@ -34,4 +34,4 @@
 {"A":"a","B":"b"} <= {"A":"a","B":"b"} true
 17 <= 17.0000000000001 true
 "foo" <= "bar" false
-

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_lt/index.html b/api/basic_json/operator_lt/index.html index 4b75c3ac8..1c655b3fe 100644 --- a/api/basic_json/operator_lt/index.html +++ b/api/basic_json/operator_lt/index.html @@ -1,4 +1,4 @@ - operator< - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator<

// until C++20
+ operator< - JSON for Modern C++      

nlohmann::basic_json::operator<

// until C++20
 bool operator<(const_reference lhs, const_reference rhs) noexcept;   // (1)
 
 template<typename ScalarType>
@@ -34,4 +34,4 @@
 {"A":"a","B":"b"} == {"A":"a","B":"b"} false
 17 == 17.0000000000001 true
 "foo" == "bar" false
-

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
  2. Added in version 1.0.0. Conditionally removed since C++20 in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_ne/index.html b/api/basic_json/operator_ne/index.html index 0c0a3d5fb..c04424bb1 100644 --- a/api/basic_json/operator_ne/index.html +++ b/api/basic_json/operator_ne/index.html @@ -1,4 +1,4 @@ - operator!= - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator!=

// until C++20
+ operator!= - JSON for Modern C++      

nlohmann::basic_json::operator!=

// until C++20
 bool operator!=(const_reference lhs, const_reference rhs) noexcept;   // (1)
 
 template<typename ScalarType>
@@ -69,4 +69,4 @@
 17 != nullptr true
 "foo" != nullptr true
 null != nullptr false
-

Version history

  1. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
  2. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
\ No newline at end of file +

Version history

  1. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
  2. Added in version 1.0.0. Added C++20 member functions in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_spaceship/index.html b/api/basic_json/operator_spaceship/index.html index 64bfeafd8..b2dfe5a0d 100644 --- a/api/basic_json/operator_spaceship/index.html +++ b/api/basic_json/operator_spaceship/index.html @@ -1,4 +1,4 @@ - operator - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator<=>

// since C++20
+ operator - JSON for Modern C++      

nlohmann::basic_json::operator<=>

// since C++20
 class basic_json {
     std::partial_ordering operator<=>(const_reference rhs) const noexcept;  // (1)
 
@@ -93,4 +93,4 @@
 17 <=> 17.000000 := equivalent
 17 <=> nan := unordered
 "17" <=> 17 := greater
-

See also

Version history

  1. Added in version 3.11.0.
  2. Added in version 3.11.0.
\ No newline at end of file +

See also

Version history

  1. Added in version 3.11.0.
  2. Added in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/operator_value_t/index.html b/api/basic_json/operator_value_t/index.html index d9ac38b6b..f8ebabfda 100644 --- a/api/basic_json/operator_value_t/index.html +++ b/api/basic_json/operator_value_t/index.html @@ -1,4 +1,4 @@ - operator value_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::operator value_t

constexpr operator value_t() const noexcept;
+ operator value_t - JSON for Modern C++      

nlohmann::basic_json::operator value_t

constexpr operator value_t() const noexcept;
 

Return the type of the JSON value as a value from the value_t enumeration.

Return value

the type of the JSON value

Value type return value
null value_t::null
boolean value_t::boolean
string value_t::string
number (integer) value_t::number_integer
number (unsigned integer) value_t::number_unsigned
number (floating-point) value_t::number_float
object value_t::object
array value_t::array
binary value_t::binary
discarded value_t::discarded

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies operator value_t() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -45,4 +45,4 @@
 true
 true
 true
-

Version history

  • Added in version 1.0.0.
  • Added unsigned integer type in version 2.0.0.
  • Added binary type in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Added unsigned integer type in version 2.0.0.
  • Added binary type in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/other_error/index.html b/api/basic_json/other_error/index.html index 53ac170eb..a5de84aa3 100644 --- a/api/basic_json/other_error/index.html +++ b/api/basic_json/other_error/index.html @@ -1,4 +1,4 @@ - other_error - JSON for Modern C++
Skip to content

nlohmann::basic_json::other_error

class other_error : public exception;
+ other_error - JSON for Modern C++      

nlohmann::basic_json::other_error

class other_error : public exception;
 

This exception is thrown in case of errors that cannot be classified with the other exception types.

Exceptions have ids 5xx (see list of other errors).

classDiagram
   direction LR
 
@@ -59,4 +59,4 @@
 }
 

Output:

message: [json.exception.other_error.501] unsuccessful: {"op":"test","path":"/best_biscuit/name","value":"Choco Leibniz"}
 exception id: 501
-

See also

Version history

  • Since version 3.0.0.
\ No newline at end of file +

See also

Version history

\ No newline at end of file diff --git a/api/basic_json/out_of_range/index.html b/api/basic_json/out_of_range/index.html index 772d070ea..ea308c232 100644 --- a/api/basic_json/out_of_range/index.html +++ b/api/basic_json/out_of_range/index.html @@ -1,4 +1,4 @@ - out_of_range - JSON for Modern C++
Skip to content

nlohmann::basic_json::out_of_range

class out_of_range : public exception;
+ out_of_range - JSON for Modern C++      

nlohmann::basic_json::out_of_range

class out_of_range : public exception;
 

This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance in case of array indices or nonexisting object keys.

Exceptions have ids 4xx (see list of out-of-range errors).

classDiagram
   direction LR
 
@@ -49,4 +49,4 @@
 }
 

Output:

message: [json.exception.out_of_range.401] array index 4 is out of range
 exception id: 401
-

See also

Version history

  • Since version 3.0.0.
\ No newline at end of file +

See also

Version history

\ No newline at end of file diff --git a/api/basic_json/parse/index.html b/api/basic_json/parse/index.html index 6f31086ae..34d73e722 100644 --- a/api/basic_json/parse/index.html +++ b/api/basic_json/parse/index.html @@ -1,4 +1,4 @@ - parse - JSON for Modern C++
Skip to content

nlohmann::basic_json::parse

// (1)
+ parse - JSON for Modern C++      

nlohmann::basic_json::parse

// (1)
 template<typename InputType>
 static basic_json parse(InputType&& i,
                         const parser_callback_t cb = nullptr,
@@ -331,4 +331,4 @@
 }
 

Output:

[json.exception.parse_error.101] parse error at line 4, column 0: syntax error while parsing value - invalid string: control character U+000A (LF) must be escaped to \u000A or \n; last read: '"value without closing quotes<U+000A>'
 the input is invalid JSON
-

See also

  • accept - check if the input is valid JSON
  • operator>> - deserialize from stream

Version history

  • Added in version 1.0.0.
  • Overload for contiguous containers (1) added in version 2.0.3.
  • Ignoring comments via ignore_comments added in version 3.9.0.
  • Changed runtime assertion in case of FILE* null pointers to exception in version 3.11.4.

Deprecation

Overload (2) replaces calls to parse with a pair of iterators as their first parameter which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like parse({ptr, ptr+len}, ...); with parse(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file +

See also

  • accept - check if the input is valid JSON
  • operator>> - deserialize from stream

Version history

  • Added in version 1.0.0.
  • Overload for contiguous containers (1) added in version 2.0.3.
  • Ignoring comments via ignore_comments added in version 3.9.0.
  • Changed runtime assertion in case of FILE* null pointers to exception in version 3.11.4.

Deprecation

Overload (2) replaces calls to parse with a pair of iterators as their first parameter which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like parse({ptr, ptr+len}, ...); with parse(ptr, ptr+len, ...);.

You should be warned by your compiler with a -Wdeprecated-declarations warning if you are using a deprecated function.

\ No newline at end of file diff --git a/api/basic_json/parse_error/index.html b/api/basic_json/parse_error/index.html index 2e3edcbd4..8cb9c2052 100644 --- a/api/basic_json/parse_error/index.html +++ b/api/basic_json/parse_error/index.html @@ -1,4 +1,4 @@ - parse_error - JSON for Modern C++
Skip to content

nlohmann::basic_json::parse_error

class parse_error : public exception;
+ parse_error - JSON for Modern C++      

nlohmann::basic_json::parse_error

class parse_error : public exception;
 

This exception is thrown by the library when a parse error occurs. Parse errors can occur during the deserialization of JSON text, BSON, CBOR, MessagePack, UBJSON, as well as when using JSON Patch.

Member byte holds the byte index of the last read character in the input file (see note below).

Exceptions have ids 1xx (see list of parse errors).

classDiagram
   direction LR
 
@@ -50,4 +50,4 @@
 

Output:

message: [json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected ']'; expected '[', '{', or a literal
 exception id: 101
 byte position of error: 8
-

See also

Version history

  • Since version 3.0.0.
\ No newline at end of file +

See also

Version history

\ No newline at end of file diff --git a/api/basic_json/parse_event_t/index.html b/api/basic_json/parse_event_t/index.html index 4cd9e2630..8939795a6 100644 --- a/api/basic_json/parse_event_t/index.html +++ b/api/basic_json/parse_event_t/index.html @@ -1,4 +1,4 @@ - parse_event_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::parse_event_t

enum class parse_event_t : std::uint8_t {
+ parse_event_t - JSON for Modern C++      

nlohmann::basic_json::parse_event_t

enum class parse_event_t : std::uint8_t {
     object_start,
     object_end,
     array_start,
@@ -6,4 +6,4 @@
     key,
     value
 };
-

The parser callback distinguishes the following events:

  • object_start: the parser read { and started to process a JSON object
  • key: the parser read a key of a value in an object
  • object_end: the parser read } and finished processing a JSON object
  • array_start: the parser read [ and started to process a JSON array
  • array_end: the parser read ] and finished processing a JSON array
  • value: the parser finished reading a JSON value

Examples

Example when certain parse events are triggered

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

The parser callback distinguishes the following events:

  • object_start: the parser read { and started to process a JSON object
  • key: the parser read a key of a value in an object
  • object_end: the parser read } and finished processing a JSON object
  • array_start: the parser read [ and started to process a JSON array
  • array_end: the parser read ] and finished processing a JSON array
  • value: the parser finished reading a JSON value

Examples

Example when certain parse events are triggered

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/parser_callback_t/index.html b/api/basic_json/parser_callback_t/index.html index 73dafbf47..80ac31b49 100644 --- a/api/basic_json/parser_callback_t/index.html +++ b/api/basic_json/parser_callback_t/index.html @@ -1,4 +1,4 @@ - parser_callback_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::parser_callback_t

template<typename BasicJsonType>
+ parser_callback_t - JSON for Modern C++      

nlohmann::basic_json::parser_callback_t

template<typename BasicJsonType>
 using parser_callback_t =
     std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;
 

With a parser callback function, the result of parsing a JSON text can be influenced. When passed to parse, it is called on certain events (passed as parse_event_t via parameter event) with a set recursion depth depth and context JSON value parsed. The return value of the callback function is a boolean indicating whether the element that emitted the callback shall be kept or not.

We distinguish six scenarios (determined by the event type) in which the callback function can be called. The following table describes the values of the parameters depth, event, and parsed.

parameter event description parameter depth parameter parsed
parse_event_t::object_start the parser read { and started to process a JSON object depth of the parent of the JSON object a JSON value with type discarded
parse_event_t::key the parser read a key of a value in an object depth of the currently parsed JSON object a JSON string containing the key
parse_event_t::object_end the parser read } and finished processing a JSON object depth of the parent of the JSON object the parsed JSON object
parse_event_t::array_start the parser read [ and started to process a JSON array depth of the parent of the JSON array a JSON value with type discarded
parse_event_t::array_end the parser read ] and finished processing a JSON array depth of the parent of the JSON array the parsed JSON array
parse_event_t::value the parser finished reading a JSON value depth of the value the parsed JSON value

Example when certain parse events are triggered

Discarding a value (i.e., returning false) has different effects depending on the context in which function was called:

  • Discarded values in structured types are skipped. That is, the parser will behave as if the discarded value was never read.
  • In case a value outside a structured type is skipped, it is replaced with null. This case happens if the top-level element is skipped.

Parameters

depth (in)
the depth of the recursion during parsing
event (in)
an event of type parse_event_t indicating the context in the callback function has been called
parsed (in, out)
the current intermediate parse result; note that writing to this value has no effect for parse_event_t::key events

Return value

Whether the JSON value which called the function during parsing should be kept (true) or not (false). In the latter case, it is either skipped completely or replaced by an empty discarded object.

Examples

Example

The example below demonstrates the parse() function with and without callback function.

#include <iostream>
@@ -83,4 +83,4 @@
         "Width": 800
     }
 }
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/patch/index.html b/api/basic_json/patch/index.html index e691867cc..60fc2bbd0 100644 --- a/api/basic_json/patch/index.html +++ b/api/basic_json/patch/index.html @@ -1,4 +1,4 @@ - patch - JSON for Modern C++
Skip to content

nlohmann::basic_json::patch

basic_json patch(const basic_json& json_patch) const;
+ patch - JSON for Modern C++      

nlohmann::basic_json::patch

basic_json patch(const basic_json& json_patch) const;
 

JSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JSON document. With this function, a JSON Patch is applied to the current JSON value by executing all operations from the patch.

Parameters

json_patch (in)
JSON patch document

Return value

patched document

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the JSON value.

Exceptions

  • Throws parse_error.104 if the JSON patch does not consist of an array of objects.
  • Throws parse_error.105 if the JSON patch is malformed (e.g., mandatory attributes are missing); example: "operation add must have member path".
  • Throws out_of_range.401 if an array index is out of range.
  • Throws out_of_range.403 if a JSON pointer inside the patch could not be resolved successfully in the current JSON value; example: "key baz not found".
  • Throws out_of_range.405 if JSON pointer has no parent ("add", "remove", "move")
  • Throws out_of_range.501 if "test" operation was unsuccessful.

Complexity

Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is affected by the patch, the complexity can usually be neglected.

Notes

The application of a patch is atomic: Either all operations succeed and the patched document is returned or an exception is thrown. In any case, the original value is not changed: the patch is applied to a copy of the value.

Examples

Example

The following code shows how a JSON patch is applied to a value.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -43,4 +43,4 @@
         "world"
     ]
 }
-

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/patch_inplace/index.html b/api/basic_json/patch_inplace/index.html index 205d95c16..6180e0e5c 100644 --- a/api/basic_json/patch_inplace/index.html +++ b/api/basic_json/patch_inplace/index.html @@ -1,4 +1,4 @@ - patch_inplace - JSON for Modern C++
Skip to content

nlohmann::basic_json::patch_inplace

void patch_inplace(const basic_json& json_patch) const;
+ patch_inplace - JSON for Modern C++      

nlohmann::basic_json::patch_inplace

void patch_inplace(const basic_json& json_patch) const;
 

JSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JSON document. With this function, a JSON Patch is applied to the current JSON value by executing all operations from the patch. This function applies a JSON patch in place and returns void.

Parameters

json_patch (in)
JSON patch document

Exception safety

No guarantees, value may be corrupted by an unsuccessful patch operation.

Exceptions

  • Throws parse_error.104 if the JSON patch does not consist of an array of objects.
  • Throws parse_error.105 if the JSON patch is malformed (e.g., mandatory attributes are missing); example: "operation add must have member path".
  • Throws out_of_range.401 if an array index is out of range.
  • Throws out_of_range.403 if a JSON pointer inside the patch could not be resolved successfully in the current JSON value; example: "key baz not found".
  • Throws out_of_range.405 if JSON pointer has no parent ("add", "remove", "move")
  • Throws out_of_range.501 if "test" operation was unsuccessful.

Complexity

Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is affected by the patch, the complexity can usually be neglected.

Notes

Unlike patch, patch_inplace applies the operation "in place" and no copy of the JSON value is created. That makes it faster for large documents by avoiding the copy. However, the JSON value might be corrupted if the function throws an exception.

Examples

Example

The following code shows how a JSON patch is applied to a value.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -47,4 +47,4 @@
         "world"
     ]
 }
-

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/basic_json/push_back/index.html b/api/basic_json/push_back/index.html index 66a4d6544..c26eac59f 100644 --- a/api/basic_json/push_back/index.html +++ b/api/basic_json/push_back/index.html @@ -1,4 +1,4 @@ - push_back - JSON for Modern C++
Skip to content

nlohmann::basic_json::push_back

// (1)
+ push_back - JSON for Modern C++      

nlohmann::basic_json::push_back

// (1)
 void push_back(basic_json&& val);
 void push_back(const basic_json& val);
 
@@ -96,4 +96,4 @@
 null
 {"four":4,"one":1,"three":3,"two":2}
 [["five",5]]
-

See also

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 2.0.0.
\ No newline at end of file +

See also

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/rbegin/index.html b/api/basic_json/rbegin/index.html index 600b18d9a..dedd6ff22 100644 --- a/api/basic_json/rbegin/index.html +++ b/api/basic_json/rbegin/index.html @@ -1,4 +1,4 @@ - rbegin - JSON for Modern C++
Skip to content

nlohmann::basic_json::rbegin

reverse_iterator rbegin() noexcept;
+ rbegin - JSON for Modern C++      

nlohmann::basic_json::rbegin

reverse_iterator rbegin() noexcept;
 const_reverse_iterator rbegin() const noexcept;
 

Returns an iterator to the reverse-beginning; that is, the last element.

Illustration from cppreference.com

Return value

reverse iterator to the first element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for rbegin().

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -17,4 +17,4 @@
     std::cout << *it << '\n';
 }
 

Output:

5
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/rend/index.html b/api/basic_json/rend/index.html index f83cae9f3..609138885 100644 --- a/api/basic_json/rend/index.html +++ b/api/basic_json/rend/index.html @@ -1,4 +1,4 @@ - rend - JSON for Modern C++
Skip to content

nlohmann::basic_json::rend

reverse_iterator rend() noexcept;
+ rend - JSON for Modern C++      

nlohmann::basic_json::rend

reverse_iterator rend() noexcept;
 const_reverse_iterator rend() const noexcept;
 

Returns an iterator to the reverse-end; that is, one before the first element. This element acts as a placeholder, attempting to access it results in undefined behavior.

Illustration from cppreference.com

Return value

reverse iterator to the element following the last element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code shows an example for eend().

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -20,4 +20,4 @@
     std::cout << *it << '\n';
 }
 

Output:

1
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/sax_parse/index.html b/api/basic_json/sax_parse/index.html index be5a2fcb4..bb8d90a6e 100644 --- a/api/basic_json/sax_parse/index.html +++ b/api/basic_json/sax_parse/index.html @@ -1,4 +1,4 @@ - sax_parse - JSON for Modern C++
Skip to content

nlohmann::basic_json::sax_parse

// (1)
+ sax_parse - JSON for Modern C++      

nlohmann::basic_json::sax_parse

// (1)
 template <typename InputType, typename SAX>
 static bool sax_parse(InputType&& i,
                       SAX* sax,
@@ -181,4 +181,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
  • Ignoring comments via ignore_comments added in version 3.9.0.

Deprecation

Overload (2) replaces calls to sax_parse with a pair of iterators as their first parameter which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like sax_parse({ptr, ptr+len}); with sax_parse(ptr, ptr+len);.

\ No newline at end of file +

Version history

  • Added in version 3.2.0.
  • Ignoring comments via ignore_comments added in version 3.9.0.

Deprecation

Overload (2) replaces calls to sax_parse with a pair of iterators as their first parameter which has been deprecated in version 3.8.0. This overload will be removed in version 4.0.0. Please replace all calls like sax_parse({ptr, ptr+len}); with sax_parse(ptr, ptr+len);.

\ No newline at end of file diff --git a/api/basic_json/size/index.html b/api/basic_json/size/index.html index ed65df197..078a75ca7 100644 --- a/api/basic_json/size/index.html +++ b/api/basic_json/size/index.html @@ -1,4 +1,4 @@ - size - JSON for Modern C++
Skip to content

nlohmann::basic_json::size

size_type size() const noexcept;
+ size - JSON for Modern C++      

nlohmann::basic_json::size

size_type size() const noexcept;
 

Returns the number of elements in a JSON value.

Return value

The return value depends on the different types and is defined as follows:

Value type return value
null 0
boolean 1
string 1
number 1
binary 1
object result of function object_t::size()
array result of function array_t::size()

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant, as long as array_t and object_t satisfy the Container concept; that is, their size() functions have constant complexity.

Notes

This function does not return the length of a string stored as JSON value -- it returns the number of elements in the JSON value which is 1 in the case of a string.

Examples

Example

The following code calls size() on the different value types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -37,4 +37,4 @@
 5
 0
 1
-

Version history

  • Added in version 1.0.0.
  • Extended to return 1 for binary types in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Extended to return 1 for binary types in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/start_pos/index.html b/api/basic_json/start_pos/index.html index 5ffc90830..a4f767c6d 100644 --- a/api/basic_json/start_pos/index.html +++ b/api/basic_json/start_pos/index.html @@ -1,4 +1,4 @@ - start_pos - JSON for Modern C++
Skip to content

nlohmann::basic_json::start_pos

#if JSON_DIAGNOSTIC_POSITIONS
+ start_pos - JSON for Modern C++      

nlohmann::basic_json::start_pos

#if JSON_DIAGNOSTIC_POSITIONS
 constexpr std::size_t start_pos() const noexcept;
 #endif
 

Returns the position of the first character in the JSON string from which the value was parsed from.

JSON type return value
object position of the opening {
array position of the opening [
string position of the opening "
number position of the first character
boolean position of t for true and f for false
null position of n

Return value

the position of the first character of the value in the parsed JSON string, if the value was created by the parse function, or std::string::npos if the value was constructed otherwise

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Notes

Note

The function is only available if macro JSON_DIAGNOSTIC_POSITIONS has been defined to 1 before including the library header.

Invalidation

The returned positions are only valid as long as the JSON value is not changed. The positions are not updated when the JSON value is changed.

Examples

Example
#include <iostream>
@@ -101,4 +101,4 @@ Original string:
 1
 Parsed string: 
 1
-

The output shows the start/end positions of all the objects and fields in the JSON string.

See also

Version history

  • Added in version 3.12.0.
\ No newline at end of file +

The output shows the start/end positions of all the objects and fields in the JSON string.

See also

Version history

  • Added in version 3.12.0.
\ No newline at end of file diff --git a/api/basic_json/std_hash/index.html b/api/basic_json/std_hash/index.html index 65d06ba30..1c699fd37 100644 --- a/api/basic_json/std_hash/index.html +++ b/api/basic_json/std_hash/index.html @@ -1,4 +1,4 @@ - std::hash<basic_json> - JSON for Modern C++
Skip to content

std::hash<nlohmann::basic_json>

namespace std {
+ std::hash<basic_json> - JSON for Modern C++      

std::hash<nlohmann::basic_json>

namespace std {
     struct hash<nlohmann::basic_json>;
 }
 

Return a hash value for a JSON object. The hash function tries to rely on std::hash where possible. Furthermore, the type of the JSON value is taken into account to have different hash values for null, 0, 0U, and false, etc.

Examples

Example

The example shows how to calculate hash values for different JSON values.

#include <iostream>
@@ -28,4 +28,4 @@
 hash({}) = 2654435832
 hash([]) = 2654435899
 hash({"hello": "world"}) = 4469488738203676328
-

Note the output is platform-dependent.

Version history

  • Added in version 1.0.0.
  • Extended for arbitrary basic_json types in version 3.10.5.
\ No newline at end of file +

Note the output is platform-dependent.

Version history

  • Added in version 1.0.0.
  • Extended for arbitrary basic_json types in version 3.10.5.
\ No newline at end of file diff --git a/api/basic_json/std_swap/index.html b/api/basic_json/std_swap/index.html index dc64f96ea..a0693b634 100644 --- a/api/basic_json/std_swap/index.html +++ b/api/basic_json/std_swap/index.html @@ -1,4 +1,4 @@ - std::swap<basic_json> - JSON for Modern C++
Skip to content

std::swap<basic_json>

namespace std {
+ std::swap<basic_json> - JSON for Modern C++      

std::swap<basic_json>

namespace std {
     void swap(nlohmann::basic_json& j1, nlohmann::basic_json& j2);
 }
 

Exchanges the values of two JSON objects.

Parameters

j1 (in, out)
value to be replaced by j2
j2 (in, out)
value to be replaced by j1

Possible implementation

void swap(nlohmann::basic_json& j1, nlohmann::basic_json& j2)
@@ -26,4 +26,4 @@
 }
 

Output:

j1 = {"one":1,"two":2} | j2 = [1,2,4,8,16]
 j1 = [1,2,4,8,16] | j2 = {"one":1,"two":2}
-

See also

Version history

  • Added in version 1.0.0.
  • Extended for arbitrary basic_json types in version 3.10.5.
\ No newline at end of file +

See also

Version history

  • Added in version 1.0.0.
  • Extended for arbitrary basic_json types in version 3.10.5.
\ No newline at end of file diff --git a/api/basic_json/string_t/index.html b/api/basic_json/string_t/index.html index f26db8830..382e3d695 100644 --- a/api/basic_json/string_t/index.html +++ b/api/basic_json/string_t/index.html @@ -1,4 +1,4 @@ - string_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::string_t

using string_t = StringType;
+ string_t - JSON for Modern C++      

nlohmann::basic_json::string_t

using string_t = StringType;
 

The type used to store JSON strings.

RFC 8259 describes JSON strings as follows:

A string is a sequence of zero or more Unicode characters.

To store objects in C++, a type is defined by the template parameter described below. Unicode values are split by the JSON class into byte-sized characters during deserialization.

Template parameters

StringType
the container to store strings (e.g., std::string). Note this container is used for keys/names in objects, see object_t.

Notes

Default type

With the default values for StringType (std::string), the default value for string_t is std::string.

Encoding

Strings are stored in UTF-8 encoding. Therefore, functions like std::string::size() or std::string::length() return the number of bytes in the string rather than the number of characters or glyphs.

String comparison

RFC 8259 states:

Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that "a\\b" and "a\u005Cb" are not equal.

This implementation is interoperable as it does compare strings code unit by code unit.

Storage

String values are stored as pointers in a basic_json type. That is, for any access to string values, a pointer of type string_t* must be dereferenced.

Examples

Example

The following code shows that string_t is by default, a typedef to std::string.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -10,4 +10,4 @@
     std::cout << std::boolalpha << std::is_same<std::string, json::string_t>::value << std::endl;
 }
 

Output:

true
-

Version history

  • Added in version 1.0.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/basic_json/swap/index.html b/api/basic_json/swap/index.html index a660a5a10..83d7809f8 100644 --- a/api/basic_json/swap/index.html +++ b/api/basic_json/swap/index.html @@ -1,4 +1,4 @@ - swap - JSON for Modern C++
Skip to content

nlohmann::basic_json::swap

// (1)
+ swap - JSON for Modern C++      

nlohmann::basic_json::swap

// (1)
 void swap(reference other) noexcept;
 
 // (2)
@@ -126,4 +126,4 @@
 }
 

Output:

value = {"bytes":[4,5,6],"subtype":null}
 binary = {"bytes":[1,2,3],"subtype":null}
-

See also

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 1.0.0.
  4. Since version 1.0.0.
  5. Since version 1.0.0.
  6. Since version 3.8.0.
  7. Since version 3.8.0.
\ No newline at end of file +

See also

Version history

  1. Since version 1.0.0.
  2. Since version 1.0.0.
  3. Since version 1.0.0.
  4. Since version 1.0.0.
  5. Since version 1.0.0.
  6. Since version 3.8.0.
  7. Since version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/to_bjdata/index.html b/api/basic_json/to_bjdata/index.html index 133b9d367..d13a2d4a1 100644 --- a/api/basic_json/to_bjdata/index.html +++ b/api/basic_json/to_bjdata/index.html @@ -1,4 +1,4 @@ - to_bjdata - JSON for Modern C++
Skip to content

nlohmann::basic_json::to_bjdata

// (1)
+ to_bjdata - JSON for Modern C++      

nlohmann::basic_json::to_bjdata

// (1)
 static std::vector<std::uint8_t> to_bjdata(const basic_json& j,
                                            const bool use_size = false,
                                            const bool use_type = false,
@@ -79,4 +79,4 @@
 [i1i2i3i4i5i6i7i8]
 [#i8i1i2i3i4i5i6i7i8
 [$i#i812345678
-

Version history

  • Added in version 3.11.0.
  • BJData version parameter (for draft3 binary encoding) added in version 3.12.0.
\ No newline at end of file +

Version history

  • Added in version 3.11.0.
  • BJData version parameter (for draft3 binary encoding) added in version 3.12.0.
\ No newline at end of file diff --git a/api/basic_json/to_bson/index.html b/api/basic_json/to_bson/index.html index d541afdf1..b647591c6 100644 --- a/api/basic_json/to_bson/index.html +++ b/api/basic_json/to_bson/index.html @@ -1,4 +1,4 @@ - to_bson - JSON for Modern C++
Skip to content

nlohmann::basic_json::to_bson

// (1)
+ to_bson - JSON for Modern C++      

nlohmann::basic_json::to_bson

// (1)
 static std::vector<std::uint8_t> to_bson(const basic_json& j);
 
 // (2)
@@ -27,4 +27,4 @@
     std::cout << std::endl;
 }
 

Output:

0x1b 0x00 0x00 0x00 0x08 0x63 0x6f 0x6d 0x70 0x61 0x63 0x74 0x00 0x01 0x10 0x73 0x63 0x68 0x65 0x6d 0x61 0x00 0x00 0x00 0x00 0x00 0x00 
-

Version history

  • Added in version 3.4.0.
\ No newline at end of file +

Version history

  • Added in version 3.4.0.
\ No newline at end of file diff --git a/api/basic_json/to_cbor/index.html b/api/basic_json/to_cbor/index.html index 35072dd99..4f4fef5d3 100644 --- a/api/basic_json/to_cbor/index.html +++ b/api/basic_json/to_cbor/index.html @@ -1,4 +1,4 @@ - to_cbor - JSON for Modern C++
Skip to content

nlohmann::basic_json::to_cbor

// (1)
+ to_cbor - JSON for Modern C++      

nlohmann::basic_json::to_cbor

// (1)
 static std::vector<std::uint8_t> to_cbor(const basic_json& j);
 
 // (2)
@@ -27,4 +27,4 @@
     std::cout << std::endl;
 }
 

Output:

0xa2 0x67 0x63 0x6f 0x6d 0x70 0x61 0x63 0x74 0xf5 0x66 0x73 0x63 0x68 0x65 0x6d 0x61 0x00 
-

Version history

  • Added in version 2.0.9.
  • Compact representation of floating-point numbers added in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 2.0.9.
  • Compact representation of floating-point numbers added in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/to_msgpack/index.html b/api/basic_json/to_msgpack/index.html index 7ed044e26..178e5b484 100644 --- a/api/basic_json/to_msgpack/index.html +++ b/api/basic_json/to_msgpack/index.html @@ -1,4 +1,4 @@ - to_msgpack - JSON for Modern C++
Skip to content

nlohmann::basic_json::to_msgpack

// (1)
+ to_msgpack - JSON for Modern C++      

nlohmann::basic_json::to_msgpack

// (1)
 static std::vector<std::uint8_t> to_msgpack(const basic_json& j);
 
 // (2)
@@ -27,4 +27,4 @@
     std::cout << std::endl;
 }
 

Output:

0x82 0xa7 0x63 0x6f 0x6d 0x70 0x61 0x63 0x74 0xc3 0xa6 0x73 0x63 0x68 0x65 0x6d 0x61 0x00 
-

Version history

  • Added in version 2.0.9.
\ No newline at end of file +

Version history

  • Added in version 2.0.9.
\ No newline at end of file diff --git a/api/basic_json/to_string/index.html b/api/basic_json/to_string/index.html index 8e62881a6..730fa64a9 100644 --- a/api/basic_json/to_string/index.html +++ b/api/basic_json/to_string/index.html @@ -1,4 +1,4 @@ - to_string - JSON for Modern C++
Skip to content

to_string(basic_json)

template <typename BasicJsonType>
+ to_string - JSON for Modern C++      

to_string(basic_json)

template <typename BasicJsonType>
 std::string to_string(const BasicJsonType& j);
 

This function implements a user-defined to_string for JSON objects.

Template parameters

BasicJsonType
a specialization of basic_json

Return value

string containing the serialization of the JSON value

Exception safety

Strong guarantee: if an exception is thrown, there are no changes to any JSON value.

Exceptions

Throws type_error.316 if a string stored inside the JSON value is not UTF-8 encoded

Complexity

Linear.

Possible implementation

template <typename BasicJsonType>
 std::string to_string(const BasicJsonType& j)
@@ -28,4 +28,4 @@
 

Output:

{"one":1,"two":2}
 
 42
-

See also

Version history

Added in version 3.7.0.

\ No newline at end of file +

See also

Version history

Added in version 3.7.0.

\ No newline at end of file diff --git a/api/basic_json/to_ubjson/index.html b/api/basic_json/to_ubjson/index.html index 468f7be70..71fd45039 100644 --- a/api/basic_json/to_ubjson/index.html +++ b/api/basic_json/to_ubjson/index.html @@ -1,4 +1,4 @@ - to_ubjson - JSON for Modern C++
Skip to content

nlohmann::basic_json::to_ubjson

// (1)
+ to_ubjson - JSON for Modern C++      

nlohmann::basic_json::to_ubjson

// (1)
 static std::vector<std::uint8_t> to_ubjson(const basic_json& j,
                                            const bool use_size = false,
                                            const bool use_type = false);
@@ -76,4 +76,4 @@
 [i1i2i3i4i5i6i7i8]
 [#i8i1i2i3i4i5i6i7i8
 [$i#i812345678
-

Version history

  • Added in version 3.1.0.
\ No newline at end of file +

Version history

  • Added in version 3.1.0.
\ No newline at end of file diff --git a/api/basic_json/type/index.html b/api/basic_json/type/index.html index aabe67787..4b789a97c 100644 --- a/api/basic_json/type/index.html +++ b/api/basic_json/type/index.html @@ -1,4 +1,4 @@ - type - JSON for Modern C++
Skip to content

nlohmann::basic_json::type

constexpr value_t type() const noexcept;
+ type - JSON for Modern C++      

nlohmann::basic_json::type

constexpr value_t type() const noexcept;
 

Return the type of the JSON value as a value from the value_t enumeration.

Return value

the type of the JSON value

Value type return value
null value_t::null
boolean value_t::boolean
string value_t::string
number (integer) value_t::number_integer
number (unsigned integer) value_t::number_unsigned
number (floating-point) value_t::number_float
object value_t::object
array value_t::array
binary value_t::binary
discarded value_t::discarded

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies type() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -35,4 +35,4 @@
 true
 true
 true
-

Version history

  • Added in version 1.0.0.
  • Added unsigned integer type in version 2.0.0.
  • Added binary type in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Added unsigned integer type in version 2.0.0.
  • Added binary type in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/type_error/index.html b/api/basic_json/type_error/index.html index ff3981958..b358cd0af 100644 --- a/api/basic_json/type_error/index.html +++ b/api/basic_json/type_error/index.html @@ -1,4 +1,4 @@ - type_error - JSON for Modern C++
Skip to content

nlohmann::basic_json::type_error

class type_error : public exception;
+ type_error - JSON for Modern C++      

nlohmann::basic_json::type_error

class type_error : public exception;
 

This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type does not match the expected semantics.

Exceptions have ids 3xx (see list of type errors).

classDiagram
   direction LR
 
@@ -49,4 +49,4 @@
 }
 

Output:

message: [json.exception.type_error.308] cannot use push_back() with string
 exception id: 308
-

See also

Version history

  • Since version 3.0.0.
\ No newline at end of file +

See also

Version history

\ No newline at end of file diff --git a/api/basic_json/type_name/index.html b/api/basic_json/type_name/index.html index 90f3166ae..c9aa37183 100644 --- a/api/basic_json/type_name/index.html +++ b/api/basic_json/type_name/index.html @@ -1,4 +1,4 @@ - type_name - JSON for Modern C++
Skip to content

nlohmann::basic_json::type_name

const char* type_name() const noexcept;
+ type_name - JSON for Modern C++      

nlohmann::basic_json::type_name

const char* type_name() const noexcept;
 

Returns the type name as string to be used in error messages -- usually to indicate that a function was called on a wrong JSON type.

Return value

a string representation of the type (value_t):

Value type return value
null "null"
boolean "boolean"
string "string"
number (integer, unsigned integer, floating-point) "number"
object "object"
array "array"
binary "binary"
discarded "discarded"

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

Example

The following code exemplifies type_name() for all JSON types.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -34,4 +34,4 @@
 {"one":1,"two":2} is an object
 [1,2,4,8,16] is an array
 "Hello, world" is a string
-

Version history

  • Added in version 1.0.0.
  • Part of the public API version since 2.1.0.
  • Changed return value to const char* and added noexcept in version 3.0.0.
  • Added support for binary type in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Part of the public API version since 2.1.0.
  • Changed return value to const char* and added noexcept in version 3.0.0.
  • Added support for binary type in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/unflatten/index.html b/api/basic_json/unflatten/index.html index 2df0fa8e9..b73e5a9dd 100644 --- a/api/basic_json/unflatten/index.html +++ b/api/basic_json/unflatten/index.html @@ -1,4 +1,4 @@ - unflatten - JSON for Modern C++
Skip to content

nlohmann::basic_json::unflatten

basic_json unflatten() const;
+ unflatten - JSON for Modern C++      

nlohmann::basic_json::unflatten

basic_json unflatten() const;
 

The function restores the arbitrary nesting of a JSON value that has been flattened before using the flatten() function. The JSON value must meet certain constraints:

  1. The value must be an object.
  2. The keys must be JSON pointers (see RFC 6901)
  3. The mapped values must be primitive JSON types.

Return value

the original JSON from a flattened version

Exception safety

Strong exception safety: if an exception occurs, the original value stays intact.

Exceptions

The function can throw the following exceptions:

Complexity

Linear in the size the JSON value.

Notes

Empty objects and arrays are flattened by flatten() to null values and can not unflattened to their original type. Apart from this example, for a JSON value j, the following is always true: j == j.flatten().unflatten().

Examples

Example

The following code shows how a flattened JSON object is unflattened into the original nested JSON object.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -43,4 +43,4 @@
     },
     "pi": 3.141
 }
-

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.0.0.
\ No newline at end of file diff --git a/api/basic_json/update/index.html b/api/basic_json/update/index.html index 64048a589..97bfc153f 100644 --- a/api/basic_json/update/index.html +++ b/api/basic_json/update/index.html @@ -1,4 +1,4 @@ - update - JSON for Modern C++
Skip to content

nlohmann::basic_json::update

// (1)
+ update - JSON for Modern C++      

nlohmann::basic_json::update

// (1)
 void update(const_reference j, bool merge_objects = false);
 
 // (2)
@@ -110,4 +110,4 @@
     "active": true,
     "name": {"de": "Maus", "en": "mouse", "es": "ratón"}
 }
-

Version history

  • Added in version 3.0.0.
  • Added merge_objects parameter in 3.10.5.
\ No newline at end of file +

Version history

  • Added in version 3.0.0.
  • Added merge_objects parameter in 3.10.5.
\ No newline at end of file diff --git a/api/basic_json/value/index.html b/api/basic_json/value/index.html index ce8fa2f5e..72368a04b 100644 --- a/api/basic_json/value/index.html +++ b/api/basic_json/value/index.html @@ -1,4 +1,4 @@ - value - JSON for Modern C++
Skip to content

nlohmann::basic_json::value

// (1)
+ value - JSON for Modern C++      

nlohmann::basic_json::value

// (1)
 template<class ValueType>
 ValueType value(const typename object_t::key_type& key,
                 ValueType&& default_value) const;
@@ -136,4 +136,4 @@
               << " " << v_string << " " << v_boolean << "\n";
 }
 

Output:

1 42.23 oops false
-

See also

  • see at for access by reference with range checking
  • see operator[] for unchecked access by reference

Version history

  1. Added in version 1.0.0. Changed parameter default_value type from const ValueType& to ValueType&& in version 3.11.0.
  2. Added in version 3.11.0. Made ValueType the first template parameter in version 3.11.2.
  3. Added in version 2.0.2.
\ No newline at end of file +

See also

  • see at for access by reference with range checking
  • see operator[] for unchecked access by reference

Version history

  1. Added in version 1.0.0. Changed parameter default_value type from const ValueType& to ValueType&& in version 3.11.0.
  2. Added in version 3.11.0. Made ValueType the first template parameter in version 3.11.2.
  3. Added in version 2.0.2.
\ No newline at end of file diff --git a/api/basic_json/value_t/index.html b/api/basic_json/value_t/index.html index d2372c9bb..a7225a50b 100644 --- a/api/basic_json/value_t/index.html +++ b/api/basic_json/value_t/index.html @@ -1,4 +1,4 @@ - value_t - JSON for Modern C++
Skip to content

nlohmann::basic_json::value_t

enum class value_t : std::uint8_t {
+ value_t - JSON for Modern C++      

nlohmann::basic_json::value_t

enum class value_t : std::uint8_t {
     null,
     object,
     array,
@@ -46,4 +46,4 @@
 true
 true
 true
-

Version history

  • Added in version 1.0.0.
  • Added unsigned integer type in version 2.0.0.
  • Added binary type in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Added unsigned integer type in version 2.0.0.
  • Added binary type in version 3.8.0.
\ No newline at end of file diff --git a/api/basic_json/~basic_json/index.html b/api/basic_json/~basic_json/index.html index 69b2dbe72..896bdbee0 100644 --- a/api/basic_json/~basic_json/index.html +++ b/api/basic_json/~basic_json/index.html @@ -1,2 +1,2 @@ - (Destructor) - JSON for Modern C++
Skip to content

nlohmann::basic_json::~basic_json

~basic_json() noexcept;
-

Destroys the JSON value and frees all allocated memory.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Linear.

Version history

  • Added in version 1.0.0.
\ No newline at end of file + (Destructor) - JSON for Modern C++
Skip to content

nlohmann::basic_json::~basic_json

~basic_json() noexcept;
+

Destroys the JSON value and frees all allocated memory.

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Linear.

Version history

  • Added in version 1.0.0.
\ No newline at end of file diff --git a/api/byte_container_with_subtype/byte_container_with_subtype/index.html b/api/byte_container_with_subtype/byte_container_with_subtype/index.html index fdd4362b2..dcc155033 100644 --- a/api/byte_container_with_subtype/byte_container_with_subtype/index.html +++ b/api/byte_container_with_subtype/byte_container_with_subtype/index.html @@ -1,4 +1,4 @@ - (constructor) - JSON for Modern C++
Skip to content

nlohmann::byte_container_with_subtype::byte_container_with_subtype

// (1)
+ (constructor) - JSON for Modern C++      

nlohmann::byte_container_with_subtype::byte_container_with_subtype

// (1)
 byte_container_with_subtype();
 
 // (2)
@@ -34,4 +34,4 @@
 

Output:

{"bytes":[],"subtype":null}
 {"bytes":[202,254,186,190],"subtype":null}
 {"bytes":[202,254,186,190],"subtype":42}
-

Version history

Since version 3.8.0.

\ No newline at end of file +

Version history

Since version 3.8.0.

\ No newline at end of file diff --git a/api/byte_container_with_subtype/clear_subtype/index.html b/api/byte_container_with_subtype/clear_subtype/index.html index 3cd38c8e8..cb2973df3 100644 --- a/api/byte_container_with_subtype/clear_subtype/index.html +++ b/api/byte_container_with_subtype/clear_subtype/index.html @@ -1,4 +1,4 @@ - clear_subtype - JSON for Modern C++
Skip to content

nlohmann::byte_container_with_subtype::clear_subtype

void clear_subtype() noexcept;
+ clear_subtype - JSON for Modern C++      

nlohmann::byte_container_with_subtype::clear_subtype

void clear_subtype() noexcept;
 

Clears the binary subtype and flags the value as not having a subtype, which has implications for serialization; for instance MessagePack will prefer the bin family over the ext family.

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant.

Examples

Example

The example below demonstrates how clear_subtype can remove subtypes.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -22,4 +22,4 @@
 }
 

Output:

before calling clear_subtype(): {"bytes":[202,254,186,190],"subtype":42}
 after calling clear_subtype(): {"bytes":[202,254,186,190],"subtype":null}
-

Version history

Since version 3.8.0.

\ No newline at end of file +

Version history

Since version 3.8.0.

\ No newline at end of file diff --git a/api/byte_container_with_subtype/has_subtype/index.html b/api/byte_container_with_subtype/has_subtype/index.html index e047a6d6e..8ef00b387 100644 --- a/api/byte_container_with_subtype/has_subtype/index.html +++ b/api/byte_container_with_subtype/has_subtype/index.html @@ -1,4 +1,4 @@ - has_subtype - JSON for Modern C++
Skip to content

nlohmann::byte_container_with_subtype::has_subtype

constexpr bool has_subtype() const noexcept;
+ has_subtype - JSON for Modern C++      

nlohmann::byte_container_with_subtype::has_subtype

constexpr bool has_subtype() const noexcept;
 

Returns whether the value has a subtype.

Return value

whether the value has a subtype

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant.

Examples

Example

The example below demonstrates how has_subtype can check whether a subtype was set.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -20,4 +20,4 @@
 }
 

Output:

c1.has_subtype() = false
 c2.has_subtype() = true
-

Version history

Since version 3.8.0.

\ No newline at end of file +

Version history

Since version 3.8.0.

\ No newline at end of file diff --git a/api/byte_container_with_subtype/index.html b/api/byte_container_with_subtype/index.html index 6ca6f7b42..c03209a2e 100644 --- a/api/byte_container_with_subtype/index.html +++ b/api/byte_container_with_subtype/index.html @@ -1,3 +1,3 @@ - Overview - JSON for Modern C++
Skip to content

nlohmann::byte_container_with_subtype

template<typename BinaryType>
+ Overview - JSON for Modern C++      

nlohmann::byte_container_with_subtype

template<typename BinaryType>
 class byte_container_with_subtype : public BinaryType;
-

This type extends the template parameter BinaryType provided to basic_json with a subtype used by BSON and MessagePack. This type exists so that the user does not have to specify a type themselves with a specific naming scheme in order to override the binary type.

Template parameters

BinaryType
container to store bytes (std::vector<std::uint8_t> by default)

Member types

  • container_type - the type of the underlying container (BinaryType)
  • subtype_type - the type of the subtype (std::uint64_t)

Member functions

Version history

  • Added in version 3.8.0.
  • Changed type of subtypes to std::uint64_t in 3.10.0.
\ No newline at end of file +

This type extends the template parameter BinaryType provided to basic_json with a subtype used by BSON and MessagePack. This type exists so that the user does not have to specify a type themselves with a specific naming scheme in order to override the binary type.

Template parameters

BinaryType
container to store bytes (std::vector<std::uint8_t> by default)

Member types

  • container_type - the type of the underlying container (BinaryType)
  • subtype_type - the type of the subtype (std::uint64_t)

Member functions

Version history

  • Added in version 3.8.0.
  • Changed type of subtypes to std::uint64_t in 3.10.0.
\ No newline at end of file diff --git a/api/byte_container_with_subtype/set_subtype/index.html b/api/byte_container_with_subtype/set_subtype/index.html index 9020a49a7..b030dd0df 100644 --- a/api/byte_container_with_subtype/set_subtype/index.html +++ b/api/byte_container_with_subtype/set_subtype/index.html @@ -1,4 +1,4 @@ - set_subtype - JSON for Modern C++
Skip to content

nlohmann::byte_container_with_subtype::set_subtype

void set_subtype(subtype_type subtype) noexcept;
+ set_subtype - JSON for Modern C++      

nlohmann::byte_container_with_subtype::set_subtype

void set_subtype(subtype_type subtype) noexcept;
 

Sets the binary subtype of the value, also flags a binary JSON value as having a subtype, which has implications for serialization.

Parameters

subtype (in)
subtype to set

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant.

Examples

Example

The example below demonstrates how a subtype can be set with set_subtype.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -23,4 +23,4 @@
 }
 

Output:

before calling set_subtype(42): {"bytes":[202,254,186,190],"subtype":null}
 after calling set_subtype(42): {"bytes":[202,254,186,190],"subtype":42}
-

Version history

Since version 3.8.0.

\ No newline at end of file +

Version history

Since version 3.8.0.

\ No newline at end of file diff --git a/api/byte_container_with_subtype/subtype/index.html b/api/byte_container_with_subtype/subtype/index.html index 6655c3d68..546f2c178 100644 --- a/api/byte_container_with_subtype/subtype/index.html +++ b/api/byte_container_with_subtype/subtype/index.html @@ -1,4 +1,4 @@ - subtype - JSON for Modern C++
Skip to content

nlohmann::byte_container_with_subtype::subtype

constexpr subtype_type subtype() const noexcept;
+ subtype - JSON for Modern C++      

nlohmann::byte_container_with_subtype::subtype

constexpr subtype_type subtype() const noexcept;
 

Returns the numerical subtype of the value if it has a subtype. If it does not have a subtype, this function will return subtype_type(-1) as a sentinel value.

Return value

the numerical subtype of the binary value, or subtype_type(-1) if no subtype is set

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant.

Examples

Example

The example below demonstrates how the subtype can be retrieved with subtype. Note how subtype_type(-1) is returned for container c1.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -23,4 +23,4 @@
 }
 

Output:

c1.subtype() = 18446744073709551615
 c2.subtype() = 42
-

Version history

  • Added in version 3.8.0
  • Fixed return value to properly return subtype_type(-1) as documented in version 3.10.0.
\ No newline at end of file +

Version history

  • Added in version 3.8.0
  • Fixed return value to properly return subtype_type(-1) as documented in version 3.10.0.
\ No newline at end of file diff --git a/api/json/index.html b/api/json/index.html index 107c14bb9..3fef89153 100644 --- a/api/json/index.html +++ b/api/json/index.html @@ -1,4 +1,4 @@ - json - JSON for Modern C++
Skip to content

nlohmann::json

using json = basic_json<>;
+ json - JSON for Modern C++      

nlohmann::json

using json = basic_json<>;
 

This type is the default specialization of the basic_json class which uses the standard template types.

Examples

Example

The example below demonstrates how to use the type nlohmann::json.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
@@ -65,4 +65,4 @@
     "pi": 3.141,
     "size": 8
 }
-

Version history

Since version 1.0.0.

\ No newline at end of file +

Version history

Since version 1.0.0.

\ No newline at end of file diff --git a/api/json_pointer/back/index.html b/api/json_pointer/back/index.html index caf34c97c..f8c965995 100644 --- a/api/json_pointer/back/index.html +++ b/api/json_pointer/back/index.html @@ -1,4 +1,4 @@ - back - JSON for Modern C++
Skip to content

nlohmann::json_pointer::back

const string_t& back() const;
+ back - JSON for Modern C++      

nlohmann::json_pointer::back

const string_t& back() const;
 

Return last reference token.

Return value

Last reference token.

Exceptions

Throws out_of_range.405 if JSON pointer has no parent.

Complexity

Constant.

Examples

Example

The example shows the usage of back.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -16,4 +16,4 @@
 }
 

Output:

last reference token of "/foo" is "foo"
 last reference token of "/foo/0" is "0"
-

Version history

  • Added in version 3.6.0.
  • Changed return type to string_t in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.6.0.
  • Changed return type to string_t in version 3.11.0.
\ No newline at end of file diff --git a/api/json_pointer/empty/index.html b/api/json_pointer/empty/index.html index ab594e312..686c2e6c9 100644 --- a/api/json_pointer/empty/index.html +++ b/api/json_pointer/empty/index.html @@ -1,4 +1,4 @@ - empty - JSON for Modern C++
Skip to content

nlohmann::json_pointer::empty

bool empty() const noexcept;
+ empty - JSON for Modern C++      

nlohmann::json_pointer::empty

bool empty() const noexcept;
 

Return whether pointer points to the root document.

Return value

true iff the JSON pointer points to the root document.

Exception safety

No-throw guarantee: this function never throws exceptions.

Complexity

Constant.

Examples

Example

The example shows the result of empty for different JSON Pointers.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -23,4 +23,4 @@
 "": true
 "/foo": false
 "/foo/0": false
-

Version history

Added in version 3.6.0.

\ No newline at end of file +

Version history

Added in version 3.6.0.

\ No newline at end of file diff --git a/api/json_pointer/index.html b/api/json_pointer/index.html index 93c7fb9df..19ae9094e 100644 --- a/api/json_pointer/index.html +++ b/api/json_pointer/index.html @@ -1,3 +1,3 @@ - Overview - JSON for Modern C++
Skip to content

nlohmann::json_pointer

template<typename RefStringType>
+ Overview - JSON for Modern C++      

nlohmann::json_pointer

template<typename RefStringType>
 class json_pointer;
-

A JSON pointer defines a string syntax for identifying a specific value within a JSON document. It can be used with functions at and operator[]. Furthermore, JSON pointers are the base for JSON patches.

Template parameters

RefStringType
the string type used for the reference tokens making up the JSON pointer

Deprecation

For backwards compatibility RefStringType may also be a specialization of basic_json in which case string_t will be deduced as basic_json::string_t. This feature is deprecated and may be removed in a future major version.

Member types

  • string_t - the string type used for the reference tokens

Member functions

Literals

See also

Version history

  • Added in version 2.0.0.
  • Changed template parameter from basic_json to string type in version 3.11.0.
\ No newline at end of file +

A JSON pointer defines a string syntax for identifying a specific value within a JSON document. It can be used with functions at and operator[]. Furthermore, JSON pointers are the base for JSON patches.

Template parameters

RefStringType
the string type used for the reference tokens making up the JSON pointer

Deprecation

For backwards compatibility RefStringType may also be a specialization of basic_json in which case string_t will be deduced as basic_json::string_t. This feature is deprecated and may be removed in a future major version.

Member types

  • string_t - the string type used for the reference tokens

Member functions

Literals

See also

Version history

  • Added in version 2.0.0.
  • Changed template parameter from basic_json to string type in version 3.11.0.
\ No newline at end of file diff --git a/api/json_pointer/json_pointer/index.html b/api/json_pointer/json_pointer/index.html index 95dc3bb0e..8797fe2ee 100644 --- a/api/json_pointer/json_pointer/index.html +++ b/api/json_pointer/json_pointer/index.html @@ -1,4 +1,4 @@ - (Constructor) - JSON for Modern C++
Skip to content

nlohmann::json_pointer::json_pointer

explicit json_pointer(const string_t& s = "");
+ (Constructor) - JSON for Modern C++      

nlohmann::json_pointer::json_pointer

explicit json_pointer(const string_t& s = "");
 

Create a JSON pointer according to the syntax described in Section 3 of RFC6901.

Parameters

s (in)
string representing the JSON pointer; if omitted, the empty string is assumed which references the whole JSON value

Exceptions

  • Throws parse_error.107 if the given JSON pointer s is nonempty and does not begin with a slash (/); see example below.
  • Throws parse_error.108 if a tilde (~) in the given JSON pointer s is not followed by 0 (representing ~) or 1 (representing /); see example below.

Examples

Example

The example shows the construction several valid JSON pointers as well as the exceptional behavior.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -49,4 +49,4 @@
 

Output:

[json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'foo'
 [json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'
 [json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1'
-

Version history

  • Added in version 2.0.0.
  • Changed type of s to string_t in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 2.0.0.
  • Changed type of s to string_t in version 3.11.0.
\ No newline at end of file diff --git a/api/json_pointer/operator_eq/index.html b/api/json_pointer/operator_eq/index.html index 9e3dffe41..f41ab6b8e 100644 --- a/api/json_pointer/operator_eq/index.html +++ b/api/json_pointer/operator_eq/index.html @@ -1,4 +1,4 @@ - operator== - JSON for Modern C++
Skip to content

nlohmann::json_pointer::operator==

// until C++20
+ operator== - JSON for Modern C++      

nlohmann::json_pointer::operator==

// until C++20
 template<typename RefStringTypeLhs, typename RefStringTypeRhs>
 bool operator==(
     const json_pointer<RefStringTypeLhs>& lhs,
@@ -82,4 +82,4 @@
 "" == "": true
 "/foo" == "/foo": true
 "bar" == "/foo": [json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'bar'
-

Version history

  1. Added in version 2.1.0. Added C++20 member functions in version 3.11.2.
  2. Added for backward compatibility and deprecated in version 3.11.2.
\ No newline at end of file +

Version history

  1. Added in version 2.1.0. Added C++20 member functions in version 3.11.2.
  2. Added for backward compatibility and deprecated in version 3.11.2.
\ No newline at end of file diff --git a/api/json_pointer/operator_ne/index.html b/api/json_pointer/operator_ne/index.html index 5b48c1456..8d9962bd0 100644 --- a/api/json_pointer/operator_ne/index.html +++ b/api/json_pointer/operator_ne/index.html @@ -1,4 +1,4 @@ - operator!= - JSON for Modern C++
Skip to content

nlohmann::json_pointer::operator!=

// until C++20
+ operator!= - JSON for Modern C++      

nlohmann::json_pointer::operator!=

// until C++20
 template<typename RefStringTypeLhs, typename RefStringTypeRhs>
 bool operator!=(
     const json_pointer<RefStringTypeLhs>& lhs,
@@ -72,4 +72,4 @@
 "" != "": false
 "/foo" != "/foo": false
 "bar" != "/foo": [json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'bar'
-

Version history

  1. Added in version 2.1.0.
  2. Added for backward compatibility and deprecated in version 3.11.2.
\ No newline at end of file +

Version history

  1. Added in version 2.1.0.
  2. Added for backward compatibility and deprecated in version 3.11.2.
\ No newline at end of file diff --git a/api/json_pointer/operator_slash/index.html b/api/json_pointer/operator_slash/index.html index 33bad2a9f..54376d4f9 100644 --- a/api/json_pointer/operator_slash/index.html +++ b/api/json_pointer/operator_slash/index.html @@ -1,4 +1,4 @@ - operator/ - JSON for Modern C++
Skip to content

nlohmann::json_pointer::operator/

// (1)
+ operator/ - JSON for Modern C++      

nlohmann::json_pointer::operator/

// (1)
 json_pointer operator/(const json_pointer& lhs, const json_pointer& rhs);
 
 // (2)
@@ -28,4 +28,4 @@
 

Output:

"/foo/bar/baz"
 "/foo/fob"
 "/foo/42"
-

Version history

  1. Added in version 3.6.0.
  2. Added in version 3.6.0. Changed type of token to string_t in version 3.11.0.
  3. Added in version 3.6.0.
\ No newline at end of file +

Version history

  1. Added in version 3.6.0.
  2. Added in version 3.6.0. Changed type of token to string_t in version 3.11.0.
  3. Added in version 3.6.0.
\ No newline at end of file diff --git a/api/json_pointer/operator_slasheq/index.html b/api/json_pointer/operator_slasheq/index.html index e1c4ea77e..28f80bda5 100644 --- a/api/json_pointer/operator_slasheq/index.html +++ b/api/json_pointer/operator_slasheq/index.html @@ -1,4 +1,4 @@ - operator/= - JSON for Modern C++
Skip to content

nlohmann::json_pointer::operator/=

// (1)
+ operator/= - JSON for Modern C++      

nlohmann::json_pointer::operator/=

// (1)
 json_pointer& operator/=(const json_pointer& ptr);
 
 // (2)
@@ -33,4 +33,4 @@
 "/foo/bar/baz"
 "/foo/bar/baz/fob"
 "/foo/bar/baz/fob/42"
-

Version history

  1. Added in version 3.6.0.
  2. Added in version 3.6.0. Changed type of token to string_t in version 3.11.0.
  3. Added in version 3.6.0.
\ No newline at end of file +

Version history

  1. Added in version 3.6.0.
  2. Added in version 3.6.0. Changed type of token to string_t in version 3.11.0.
  3. Added in version 3.6.0.
\ No newline at end of file diff --git a/api/json_pointer/operator_string_t/index.html b/api/json_pointer/operator_string_t/index.html index d0c5c797d..a2ed4399b 100644 --- a/api/json_pointer/operator_string_t/index.html +++ b/api/json_pointer/operator_string_t/index.html @@ -1,4 +1,4 @@ - operator string_t - JSON for Modern C++
Skip to content

nlohmann::json_pointer::operator string_t

operator string_t() const
+ operator string_t - JSON for Modern C++      

nlohmann::json_pointer::operator string_t

operator string_t() const
 

Return a string representation of the JSON pointer.

Return value

A string representation of the JSON pointer

Possible implementation

operator string_t() const
 {
     return to_string();
@@ -24,4 +24,4 @@
 }
 

Output:

/foo/0
 /a~1b
-

See also

Version history

  • Since version 2.0.0.
  • Changed type to string_t and deprecated in version 3.11.0.
\ No newline at end of file +

See also

Version history

  • Since version 2.0.0.
  • Changed type to string_t and deprecated in version 3.11.0.
\ No newline at end of file diff --git a/api/json_pointer/parent_pointer/index.html b/api/json_pointer/parent_pointer/index.html index 52eb56de2..9bb0d1744 100644 --- a/api/json_pointer/parent_pointer/index.html +++ b/api/json_pointer/parent_pointer/index.html @@ -1,4 +1,4 @@ - parent_pointer - JSON for Modern C++
Skip to content

nlohmann::json_pointer::parent_pointer

json_pointer parent_pointer() const;
+ parent_pointer - JSON for Modern C++      

nlohmann::json_pointer::parent_pointer

json_pointer parent_pointer() const;
 

Returns the parent of this JSON pointer.

Return value

Parent of this JSON pointer; in case this JSON pointer is the root, the root itself is returned.

Complexity

Linear in the length of the JSON pointer.

Examples

Example

The example shows the result of parent_pointer for different JSON Pointers.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -20,4 +20,4 @@
 

Output:

parent of "" is ""
 parent of "/foo" is ""
 parent of "/foo/0" is "/foo"
-

Version history

Added in version 3.6.0.

\ No newline at end of file +

Version history

Added in version 3.6.0.

\ No newline at end of file diff --git a/api/json_pointer/pop_back/index.html b/api/json_pointer/pop_back/index.html index 3b31d980a..e58d0ab1b 100644 --- a/api/json_pointer/pop_back/index.html +++ b/api/json_pointer/pop_back/index.html @@ -1,4 +1,4 @@ - pop_back - JSON for Modern C++
Skip to content

nlohmann::json_pointer::pop_back

void pop_back();
+ pop_back - JSON for Modern C++      

nlohmann::json_pointer::pop_back

void pop_back();
 

Remove last reference token.

Exceptions

Throws out_of_range.405 if JSON pointer has no parent.

Complexity

Constant.

Examples

Example

The example shows the usage of pop_back.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -24,4 +24,4 @@
 "/foo/bar"
 "/foo"
 ""
-

Version history

Added in version 3.6.0.

\ No newline at end of file +

Version history

Added in version 3.6.0.

\ No newline at end of file diff --git a/api/json_pointer/push_back/index.html b/api/json_pointer/push_back/index.html index 16d3ec635..6c47fdef0 100644 --- a/api/json_pointer/push_back/index.html +++ b/api/json_pointer/push_back/index.html @@ -1,4 +1,4 @@ - push_back - JSON for Modern C++
Skip to content

nlohmann::json_pointer::push_back

void push_back(const string_t& token);
+ push_back - JSON for Modern C++      

nlohmann::json_pointer::push_back

void push_back(const string_t& token);
 
 void push_back(string_t&& token);
 

Append an unescaped token at the end of the reference pointer.

Parameters

token (in)
token to add

Complexity

Amortized constant.

Examples

Example

The example shows the result of push_back for different JSON Pointers.

#include <iostream>
@@ -26,4 +26,4 @@
 "/foo"
 "/foo/0"
 "/foo/0/bar"
-

Version history

  • Added in version 3.6.0.
  • Changed type of token to string_t in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.6.0.
  • Changed type of token to string_t in version 3.11.0.
\ No newline at end of file diff --git a/api/json_pointer/string_t/index.html b/api/json_pointer/string_t/index.html index b054a6328..109d99878 100644 --- a/api/json_pointer/string_t/index.html +++ b/api/json_pointer/string_t/index.html @@ -1,4 +1,4 @@ - string_t - JSON for Modern C++
Skip to content

nlohmann::json_pointer::string_t

using string_t = RefStringType;
+ string_t - JSON for Modern C++      

nlohmann::json_pointer::string_t

using string_t = RefStringType;
 

The string type used for the reference tokens making up the JSON pointer.

See basic_json::string_t for more information.

Examples

Example

The example shows the type string_t and its relation to basic_json::string_t.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -14,4 +14,4 @@
 }
 

Output:

This is a string.
 true
-

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/json_pointer/to_string/index.html b/api/json_pointer/to_string/index.html index 4ebf314bc..f7a7c03ff 100644 --- a/api/json_pointer/to_string/index.html +++ b/api/json_pointer/to_string/index.html @@ -1,4 +1,4 @@ - to_string - JSON for Modern C++
Skip to content

nlohmann::json_pointer::to_string

string_t to_string() const;
+ to_string - JSON for Modern C++      

nlohmann::json_pointer::to_string

string_t to_string() const;
 

Return a string representation of the JSON pointer.

Return value

A string representation of the JSON pointer

Notes

For each JSON pointer ptr, it holds:

ptr == json_pointer(ptr.to_string());
 

Examples

Example

The example shows the result of to_string.

#include <iostream>
 #include <nlohmann/json.hpp>
@@ -46,4 +46,4 @@
 "/k"l"
 "/ "
 "/m~0n"
-

Version history

  • Since version 2.0.0.
  • Changed return type to string_t in version 3.11.0.
\ No newline at end of file +

Version history

  • Since version 2.0.0.
  • Changed return type to string_t in version 3.11.0.
\ No newline at end of file diff --git a/api/json_sax/binary/index.html b/api/json_sax/binary/index.html index d0a164a27..40de3bc4e 100644 --- a/api/json_sax/binary/index.html +++ b/api/json_sax/binary/index.html @@ -1,4 +1,4 @@ - binary - JSON for Modern C++
Skip to content

nlohmann::json_sax::binary

virtual bool binary(binary_t& val) = 0;
+ binary - JSON for Modern C++      

nlohmann::json_sax::binary

virtual bool binary(binary_t& val) = 0;
 

A binary value was read.

Parameters

val (in)
binary value

Return value

Whether parsing should proceed.

Notes

It is safe to move the passed binary value.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -116,4 +116,4 @@
 

Output:

binary(val=[...])
 
 result: true
-

Version history

  • Added in version 3.8.0.
\ No newline at end of file +

Version history

  • Added in version 3.8.0.
\ No newline at end of file diff --git a/api/json_sax/boolean/index.html b/api/json_sax/boolean/index.html index ef8bc6a4c..71d0ca156 100644 --- a/api/json_sax/boolean/index.html +++ b/api/json_sax/boolean/index.html @@ -1,4 +1,4 @@ - boolean - JSON for Modern C++
Skip to content

nlohmann::json_sax::boolean

virtual bool boolean(bool val) = 0;
+ boolean - JSON for Modern C++      

nlohmann::json_sax::boolean

virtual bool boolean(bool val) = 0;
 

A boolean value was read.

Parameters

val (in)
boolean value

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/end_array/index.html b/api/json_sax/end_array/index.html index 3dacad330..ff31a1df8 100644 --- a/api/json_sax/end_array/index.html +++ b/api/json_sax/end_array/index.html @@ -1,4 +1,4 @@ - end_array - JSON for Modern C++
Skip to content

nlohmann::json_sax::end_array

virtual bool end_array() = 0;
+ end_array - JSON for Modern C++      

nlohmann::json_sax::end_array

virtual bool end_array() = 0;
 

The end of an array was read.

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/end_object/index.html b/api/json_sax/end_object/index.html index 46af62907..1c6c4e17d 100644 --- a/api/json_sax/end_object/index.html +++ b/api/json_sax/end_object/index.html @@ -1,4 +1,4 @@ - end_object - JSON for Modern C++
Skip to content

nlohmann::json_sax::end_object

virtual bool end_object() = 0;
+ end_object - JSON for Modern C++      

nlohmann::json_sax::end_object

virtual bool end_object() = 0;
 

The end of an object was read.

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/index.html b/api/json_sax/index.html index b4d1ba1fb..ea243dbaa 100644 --- a/api/json_sax/index.html +++ b/api/json_sax/index.html @@ -1,3 +1,3 @@ - Overview - JSON for Modern C++
Skip to content

nlohmann::json_sax

template<typename BasicJsonType>
+ Overview - JSON for Modern C++      

nlohmann::json_sax

template<typename BasicJsonType>
 struct json_sax;
-

This class describes the SAX interface used by sax_parse. Each function is called in different situations while the input is parsed. The boolean return value informs the parser whether to continue processing the input.

Template parameters

BasicJsonType
a specialization of basic_json

Member types

Member functions

  • binary (virtual) - a binary value was read
  • boolean (virtual) - a boolean value was read
  • end_array (virtual) - the end of an array was read
  • end_object (virtual) - the end of an object was read
  • key (virtual) - an object key was read
  • null (virtual) - a null value was read
  • number_float (virtual) - a floating-point number was read
  • number_integer (virtual) - an integer number was read
  • number_unsigned (virtual) - an unsigned integer number was read
  • parse_error (virtual) - a parse error occurred
  • start_array (virtual) - the beginning of an array was read
  • start_object (virtual) - the beginning of an object was read
  • string (virtual) - a string value was read

Version history

  • Added in version 3.2.0.
  • Support for binary values (binary_t, binary) added in version 3.8.0.
\ No newline at end of file +

This class describes the SAX interface used by sax_parse. Each function is called in different situations while the input is parsed. The boolean return value informs the parser whether to continue processing the input.

Template parameters

BasicJsonType
a specialization of basic_json

Member types

Member functions

  • binary (virtual) - a binary value was read
  • boolean (virtual) - a boolean value was read
  • end_array (virtual) - the end of an array was read
  • end_object (virtual) - the end of an object was read
  • key (virtual) - an object key was read
  • null (virtual) - a null value was read
  • number_float (virtual) - a floating-point number was read
  • number_integer (virtual) - an integer number was read
  • number_unsigned (virtual) - an unsigned integer number was read
  • parse_error (virtual) - a parse error occurred
  • start_array (virtual) - the beginning of an array was read
  • start_object (virtual) - the beginning of an object was read
  • string (virtual) - a string value was read

Version history

  • Added in version 3.2.0.
  • Support for binary values (binary_t, binary) added in version 3.8.0.
\ No newline at end of file diff --git a/api/json_sax/key/index.html b/api/json_sax/key/index.html index 74c72a7c4..198a7b8f7 100644 --- a/api/json_sax/key/index.html +++ b/api/json_sax/key/index.html @@ -1,4 +1,4 @@ - key - JSON for Modern C++
Skip to content

nlohmann::json_sax::key

virtual bool key(string_t& val) = 0;
+ key - JSON for Modern C++      

nlohmann::json_sax::key

virtual bool key(string_t& val) = 0;
 

An object key was read.

Parameters

val (in)
object key

Return value

Whether parsing should proceed.

Notes

It is safe to move the passed object key value.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/null/index.html b/api/json_sax/null/index.html index 171a727b3..6cda940cf 100644 --- a/api/json_sax/null/index.html +++ b/api/json_sax/null/index.html @@ -1,4 +1,4 @@ - null - JSON for Modern C++
Skip to content

nlohmann::json_sax::null

virtual bool null() = 0;
+ null - JSON for Modern C++      

nlohmann::json_sax::null

virtual bool null() = 0;
 

A null value was read.

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/number_float/index.html b/api/json_sax/number_float/index.html index 8f71fa35d..68e7d3355 100644 --- a/api/json_sax/number_float/index.html +++ b/api/json_sax/number_float/index.html @@ -1,4 +1,4 @@ - number_float - JSON for Modern C++
Skip to content

nlohmann::json_sax::number_float

virtual bool number_float(number_float_t val, const string_t& s) = 0;
+ number_float - JSON for Modern C++      

nlohmann::json_sax::number_float

virtual bool number_float(number_float_t val, const string_t& s) = 0;
 

A floating-point number was read.

Parameters

val (in)
floating-point value
s (in)
string representation of the original input

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/number_integer/index.html b/api/json_sax/number_integer/index.html index 411c76276..91f379961 100644 --- a/api/json_sax/number_integer/index.html +++ b/api/json_sax/number_integer/index.html @@ -1,4 +1,4 @@ - number_integer - JSON for Modern C++
Skip to content

nlohmann::json_sax::number_integer

virtual bool number_integer(number_integer_t val) = 0;
+ number_integer - JSON for Modern C++      

nlohmann::json_sax::number_integer

virtual bool number_integer(number_integer_t val) = 0;
 

An integer number was read.

Parameters

val (in)
integer value

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/number_unsigned/index.html b/api/json_sax/number_unsigned/index.html index 37971c6bd..06d69db25 100644 --- a/api/json_sax/number_unsigned/index.html +++ b/api/json_sax/number_unsigned/index.html @@ -1,4 +1,4 @@ - number_unsigned - JSON for Modern C++
Skip to content

nlohmann::json_sax::number_unsigned

virtual bool number_unsigned(number_unsigned_t val) = 0;
+ number_unsigned - JSON for Modern C++      

nlohmann::json_sax::number_unsigned

virtual bool number_unsigned(number_unsigned_t val) = 0;
 

An unsigned integer number was read.

Parameters

val (in)
unsigned integer value

Return value

Whether parsing should proceed.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/parse_error/index.html b/api/json_sax/parse_error/index.html index 7cb09c3a5..fca639e58 100644 --- a/api/json_sax/parse_error/index.html +++ b/api/json_sax/parse_error/index.html @@ -1,4 +1,4 @@ - parse_error - JSON for Modern C++
Skip to content

nlohmann::json_sax::parse_error

virtual bool parse_error(std::size_t position,
+ parse_error - JSON for Modern C++      

nlohmann::json_sax::parse_error

virtual bool parse_error(std::size_t position,
                          const std::string& last_token,
                          const detail::exception& ex) = 0;
 

A parse error occurred.

Parameters

position (in)
the position in the input where the error occurs
last_token (in)
the last read token
ex (in)
an exception object describing the error

Return value

Whether parsing should proceed (must return false).

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
@@ -169,4 +169,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/start_array/index.html b/api/json_sax/start_array/index.html index da22fa20a..6164c8cca 100644 --- a/api/json_sax/start_array/index.html +++ b/api/json_sax/start_array/index.html @@ -1,4 +1,4 @@ - start_array - JSON for Modern C++
Skip to content

nlohmann::json_sax::start_array

virtual bool start_array(std::size_t elements) = 0;
+ start_array - JSON for Modern C++      

nlohmann::json_sax::start_array

virtual bool start_array(std::size_t elements) = 0;
 

The beginning of an array was read.

Parameters

elements (in)
number of object elements or -1 if unknown

Return value

Whether parsing should proceed.

Notes

Binary formats may report the number of elements.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/start_object/index.html b/api/json_sax/start_object/index.html index bc5e5cfef..64c1043a9 100644 --- a/api/json_sax/start_object/index.html +++ b/api/json_sax/start_object/index.html @@ -1,4 +1,4 @@ - start_object - JSON for Modern C++
Skip to content

nlohmann::json_sax::start_object

virtual bool start_object(std::size_t elements) = 0;
+ start_object - JSON for Modern C++      

nlohmann::json_sax::start_object

virtual bool start_object(std::size_t elements) = 0;
 

The beginning of an object was read.

Parameters

elements (in)
number of object elements or -1 if unknown

Return value

Whether parsing should proceed.

Notes

Binary formats may report the number of elements.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/json_sax/string/index.html b/api/json_sax/string/index.html index 1ea223394..49e2e514a 100644 --- a/api/json_sax/string/index.html +++ b/api/json_sax/string/index.html @@ -1,4 +1,4 @@ - string - JSON for Modern C++
Skip to content

nlohmann::json_sax::string

virtual bool string(string_t& val) = 0;
+ string - JSON for Modern C++      

nlohmann::json_sax::string

virtual bool string(string_t& val) = 0;
 

A string value was read.

Parameters

val (in)
string value

Return value

Whether parsing should proceed.

Notes

It is safe to move the passed string value.

Examples

Example

The example below shows how the SAX interface is used.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -167,4 +167,4 @@
             ex=[json.exception.parse_error.101] parse error at line 17, column 6: syntax error while parsing value - unexpected ']'; expected end of input)
 
 result: false
-

Version history

  • Added in version 3.2.0.
\ No newline at end of file +

Version history

  • Added in version 3.2.0.
\ No newline at end of file diff --git a/api/macros/index.html b/api/macros/index.html index e8edaf5c8..7ad5013e1 100644 --- a/api/macros/index.html +++ b/api/macros/index.html @@ -1 +1 @@ - Overview - JSON for Modern C++
Skip to content

Macros

Some aspects of the library can be configured by defining preprocessor macros before including the json.hpp header. See also the macro overview page.

Runtime assertions

Exceptions

Language support

Library version

Library namespace

Type conversions

Comparison behavior

Serialization/deserialization macros

Enums

Classes and structs

\ No newline at end of file + Overview - JSON for Modern C++
Skip to content

Macros

Some aspects of the library can be configured by defining preprocessor macros before including the json.hpp header. See also the macro overview page.

Runtime assertions

Exceptions

Language support

Library version

Library namespace

Type conversions

Comparison behavior

Serialization/deserialization macros

Enums

Classes and structs

\ No newline at end of file diff --git a/api/macros/json_assert/index.html b/api/macros/json_assert/index.html index 5c1210daa..51555bcb1 100644 --- a/api/macros/json_assert/index.html +++ b/api/macros/json_assert/index.html @@ -1,4 +1,4 @@ - JSON_ASSERT - JSON for Modern C++
Skip to content

JSON_ASSERT

#define JSON_ASSERT(x) /* value */
+ JSON_ASSERT - JSON for Modern C++      

JSON_ASSERT

#define JSON_ASSERT(x) /* value */
 

This macro controls which code is executed for runtime assertions of the library.

Parameters

x (in)
expression of scalar type

Default definition

The default value is assert(x).

#define JSON_ASSERT(x) assert(x)
 

Therefore, assertions can be switched off by defining NDEBUG.

Notes

  • The library uses numerous assertions to guarantee invariants and to abort in case of otherwise undefined behavior (e.g., when calling operator[] with a missing object key on a const object). See page runtime assertions for more information.
  • Defining the macro to code that does not call std::abort may leave the library in an undefined state.
  • The macro is undefined outside the library.

Examples

Example 1: default behavior

The following code will trigger an assertion at runtime:

#include <nlohmann/json.hpp>
 
@@ -24,4 +24,4 @@
     auto v = j["missing"];
 }
 

Output:

assertion error in operator[]
-

See also

Version history

  • Added in version 3.9.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.9.0.
\ No newline at end of file diff --git a/api/macros/json_diagnostic_positions/index.html b/api/macros/json_diagnostic_positions/index.html index 4f37108f5..4792f184e 100644 --- a/api/macros/json_diagnostic_positions/index.html +++ b/api/macros/json_diagnostic_positions/index.html @@ -1,4 +1,4 @@ - JSON_DIAGNOSTIC_POSITIONS - JSON for Modern C++
Skip to content

JSON_DIAGNOSTIC_POSITIONS

#define JSON_DIAGNOSTIC_POSITIONS /* value */
+ JSON_DIAGNOSTIC_POSITIONS - JSON for Modern C++      

JSON_DIAGNOSTIC_POSITIONS

#define JSON_DIAGNOSTIC_POSITIONS /* value */
 

This macro enables position diagnostics for generated JSON objects.

When enabled, two new member functions start_pos() and end_pos() are added to basic_json values. If the value was created by calling theparse function, then these functions allow to query the byte positions of the value in the input it was parsed from. In case the value was constructed by other means, std::string::npos is returned.

start_pos() returns the position of the first character of a given value in the original JSON string, while end_pos() returns the position of the character following the last character. For objects and arrays, the first and last characters correspond to the opening or closing braces/brackets, respectively. For primitive values, the first and last character represent the opening and closing quotes (strings) or the first and last character of the field's numerical or predefined value (true, false, null), respectively.

JSON type return value start_pos() return value end_pos()
object position of the opening { position after the closing }
array position of the opening [ position after the closing ]
string position of the opening " position after the closing "
number position of the first character position after the last character
boolean position of t for true and f for false position after e
null position of n position after l

Given the above, end_pos()-start_pos() for a JSON value provides the length of the parsed JSON string for that value, including the opening or closing braces, brackets, or quotes.

Note that enabling this macro increases the size of every JSON value by two std::size_t fields and adds slight runtime overhead to parsing, copying JSON value objects, and the generation of error messages for exceptions. It also causes these values to be reported in those error messages.

Default definition

The default value is 0 (position diagnostics are switched off).

#define JSON_DIAGNOSTIC_POSITIONS 0
 

When the macro is not defined, the library will define it to its default value.

Notes

CMake option

Diagnostic positions can also be controlled with the CMake option JSON_Diagnostic_Positions (OFF by default) which defines JSON_DIAGNOSTIC_POSITIONS accordingly.

Availability

Diagnostic positions are only available if the value was created by the parse function. The sax_parse function or all other means to create a JSON value do not set the diagnostic positions and start_pos() and end_pos() will only return std::string::npos for these values.

Invalidation

The returned positions are only valid as long as the JSON value is not changed. The positions are not updated when the JSON value is changed.

Examples

Example: retrieving positions
#include <iostream>
 
@@ -165,4 +165,4 @@ Parsed string:
 }
 

Output:

[json.exception.type_error.302] (/address/housenumber) (bytes 92-95) type must be number, but is string
 
The output shows the exception with diagnostic path info and start/end positions.
-

See also

Version history

  • Added in version 3.12.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.12.0.
\ No newline at end of file diff --git a/api/macros/json_diagnostics/index.html b/api/macros/json_diagnostics/index.html index 36c1f0af7..102e795f0 100644 --- a/api/macros/json_diagnostics/index.html +++ b/api/macros/json_diagnostics/index.html @@ -1,4 +1,4 @@ - JSON_DIAGNOSTICS - JSON for Modern C++
Skip to content

JSON_DIAGNOSTICS

#define JSON_DIAGNOSTICS /* value */
+ JSON_DIAGNOSTICS - JSON for Modern C++      

JSON_DIAGNOSTICS

#define JSON_DIAGNOSTICS /* value */
 

This macro enables extended diagnostics for exception messages. Possible values are 1 to enable or 0 to disable (default).

When enabled, exception messages contain a JSON Pointer to the JSON value that triggered the exception. Note that enabling this macro increases the size of every JSON value by one pointer and adds some runtime overhead.

Default definition

The default value is 0 (extended diagnostics are switched off).

#define JSON_DIAGNOSTICS 0
 

When the macro is not defined, the library will define it to its default value.

Notes

ABI compatibility

As of version 3.11.0, this macro is no longer required to be defined consistently throughout a codebase to avoid One Definition Rule (ODR) violations, as the value of this macro is encoded in the namespace, resulting in distinct symbol names.

This allows different parts of a codebase to use different versions or configurations of this library without causing improper behavior.

Where possible, it is still recommended that all code define this the same way for maximum interoperability.

CMake option

Diagnostic messages can also be controlled with the CMake option JSON_Diagnostics (OFF by default) which defines JSON_DIAGNOSTICS accordingly.

Examples

Example 1: default behavior
#include <iostream>
 #include <nlohmann/json.hpp>
@@ -75,4 +75,4 @@
     }
 }
 

Output:

[json.exception.type_error.302] (bytes 92-95) type must be number, but is string
-
The output shows the exception with start/end positions only.

See also

Version history

  • Added in version 3.10.0.
  • As of version 3.11.0 the definition is allowed to vary between translation units.
\ No newline at end of file +
The output shows the exception with start/end positions only.

See also

Version history

  • Added in version 3.10.0.
  • As of version 3.11.0 the definition is allowed to vary between translation units.
\ No newline at end of file diff --git a/api/macros/json_disable_enum_serialization/index.html b/api/macros/json_disable_enum_serialization/index.html index ecfe054ca..6ede35e43 100644 --- a/api/macros/json_disable_enum_serialization/index.html +++ b/api/macros/json_disable_enum_serialization/index.html @@ -1,4 +1,4 @@ - JSON_DISABLE_ENUM_SERIALIZATION - JSON for Modern C++
Skip to content

JSON_DISABLE_ENUM_SERIALIZATION

#define JSON_DISABLE_ENUM_SERIALIZATION /* value */
+ JSON_DISABLE_ENUM_SERIALIZATION - JSON for Modern C++      

JSON_DISABLE_ENUM_SERIALIZATION

#define JSON_DISABLE_ENUM_SERIALIZATION /* value */
 

When defined to 1, default serialization and deserialization functions for enums are excluded and have to be provided by the user, for example, using NLOHMANN_JSON_SERIALIZE_ENUM (see arbitrary type conversions for more details).

Parsing or serializing an enum will result in a compiler error.

This works for both unscoped and scoped enums.

Default definition

The default value is 0.

#define JSON_DISABLE_ENUM_SERIALIZATION 0
 

Notes

CMake option

Enum serialization can also be controlled with the CMake option JSON_DisableEnumSerialization (OFF by default) which defines JSON_DISABLE_ENUM_SERIALIZATION accordingly.

Examples

Example 1: Disabled behavior

The code below forces the library not to create default serialization/deserialization functions from_json and to_json, meaning the code below does not compile.

#define JSON_DISABLE_ENUM_SERIALIZATION 1
 #include <nlohmann/json.hpp>
@@ -89,4 +89,4 @@
     // uses user-defined from_json function
     Choice ch = j.template get<Choice>();
 }
-

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/macros/json_has_cpp_11/index.html b/api/macros/json_has_cpp_11/index.html index 0df50992b..6260bbfe5 100644 --- a/api/macros/json_has_cpp_11/index.html +++ b/api/macros/json_has_cpp_11/index.html @@ -1,4 +1,4 @@ - JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, JSON_HAS_CPP_20 - JSON for Modern C++
Skip to content

JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, JSON_HAS_CPP_20

#define JSON_HAS_CPP_11
+ JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, JSON_HAS_CPP_20 - JSON for Modern C++      

JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, JSON_HAS_CPP_20

#define JSON_HAS_CPP_11
 #define JSON_HAS_CPP_14
 #define JSON_HAS_CPP_17
 #define JSON_HAS_CPP_20
@@ -6,4 +6,4 @@
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

  • Added in version 3.10.5.
\ No newline at end of file +

Version history

  • Added in version 3.10.5.
\ No newline at end of file diff --git a/api/macros/json_has_filesystem/index.html b/api/macros/json_has_filesystem/index.html index 8cb08e38a..5b7044738 100644 --- a/api/macros/json_has_filesystem/index.html +++ b/api/macros/json_has_filesystem/index.html @@ -1,7 +1,7 @@ - JSON_HAS_EXPERIMENTAL_FILESYSTEM, JSON_HAS_FILESYSTEM - JSON for Modern C++
Skip to content

JSON_HAS_FILESYSTEM / JSON_HAS_EXPERIMENTAL_FILESYSTEM

#define JSON_HAS_FILESYSTEM /* value */
+ JSON_HAS_EXPERIMENTAL_FILESYSTEM, JSON_HAS_FILESYSTEM - JSON for Modern C++      

JSON_HAS_FILESYSTEM / JSON_HAS_EXPERIMENTAL_FILESYSTEM

#define JSON_HAS_FILESYSTEM /* value */
 #define JSON_HAS_EXPERIMENTAL_FILESYSTEM /* value */
 

When compiling with C++17, the library provides conversions from and to std::filesystem::path. As compiler support for filesystem is limited, the library tries to detect whether <filesystem>/std::filesystem (JSON_HAS_FILESYSTEM) or <experimental/filesystem>/std::experimental::filesystem (JSON_HAS_EXPERIMENTAL_FILESYSTEM) should be used. To override the built-in check, define JSON_HAS_FILESYSTEM or JSON_HAS_EXPERIMENTAL_FILESYSTEM to 1.

Default definition

The default value is detected based on the preprocessor macros __cpp_lib_filesystem, __cpp_lib_experimental_filesystem, __has_include(<filesystem>), or __has_include(<experimental/filesystem>).

Notes

  • Note that older compilers or older versions of libstd++ also require the library stdc++fs to be linked to for filesystem support.
  • Both macros are undefined outside the library.

Examples

Example

The code below forces the library to use the header <experimental/filesystem>.

#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

  • Added in version 3.10.5.
\ No newline at end of file +

Version history

  • Added in version 3.10.5.
\ No newline at end of file diff --git a/api/macros/json_has_ranges/index.html b/api/macros/json_has_ranges/index.html index 467816d05..4fa4b11f7 100644 --- a/api/macros/json_has_ranges/index.html +++ b/api/macros/json_has_ranges/index.html @@ -1,6 +1,6 @@ - JSON_HAS_RANGES - JSON for Modern C++
Skip to content

JSON_HAS_RANGES

#define JSON_HAS_RANGES /* value */
+ JSON_HAS_RANGES - JSON for Modern C++      

JSON_HAS_RANGES

#define JSON_HAS_RANGES /* value */
 

This macro indicates whether the standard library has any support for ranges. Implies support for concepts. Possible values are 1 when supported or 0 when unsupported.

Default definition

The default value is detected based on the preprocessor macro __cpp_lib_ranges.

When the macro is not defined, the library will define it to its default value.

Examples

Example

The code below forces the library to enable support for ranges:

#define JSON_HAS_RANGES 1
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/macros/json_has_static_rtti/index.html b/api/macros/json_has_static_rtti/index.html index b4a4f2d68..50fd0b77a 100644 --- a/api/macros/json_has_static_rtti/index.html +++ b/api/macros/json_has_static_rtti/index.html @@ -1,6 +1,6 @@ - JSON_HAS_STATIC_RTTI - JSON for Modern C++
Skip to content

JSON_HAS_STATIC_RTTI

#define JSON_HAS_STATIC_RTTI /* value */
+ JSON_HAS_STATIC_RTTI - JSON for Modern C++      

JSON_HAS_STATIC_RTTI

#define JSON_HAS_STATIC_RTTI /* value */
 

This macro indicates whether the standard library has any support for RTTI (run time type information). Possible values are 1 when supported or 0 when unsupported.

Default definition

The default value is detected based on the preprocessor macro _HAS_STATIC_RTTI.

When the macro is not defined, the library will define it to its default value.

Examples

Example

The code below forces the library to enable support for libraries with RTTI dependence:

#define JSON_HAS_STATIC_RTTI 1
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

  • Added in version 3.11.3.
\ No newline at end of file +

Version history

  • Added in version 3.11.3.
\ No newline at end of file diff --git a/api/macros/json_has_three_way_comparison/index.html b/api/macros/json_has_three_way_comparison/index.html index af3266b35..321c29f4e 100644 --- a/api/macros/json_has_three_way_comparison/index.html +++ b/api/macros/json_has_three_way_comparison/index.html @@ -1,6 +1,6 @@ - JSON_HAS_THREE_WAY_COMPARISON - JSON for Modern C++
Skip to content

JSON_HAS_THREE_WAY_COMPARISON

#define JSON_HAS_THREE_WAY_COMPARISON /* value */
+ JSON_HAS_THREE_WAY_COMPARISON - JSON for Modern C++      

JSON_HAS_THREE_WAY_COMPARISON

#define JSON_HAS_THREE_WAY_COMPARISON /* value */
 

This macro indicates whether the compiler and standard library support 3-way comparison. Possible values are 1 when supported or 0 when unsupported.

Default definition

The default value is detected based on the preprocessor macros __cpp_impl_three_way_comparison and __cpp_lib_three_way_comparison.

When the macro is not defined, the library will define it to its default value.

Examples

Example

The code below forces the library to use 3-way comparison:

#define JSON_HAS_THREE_WAY_COMPARISON 1
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/macros/json_no_io/index.html b/api/macros/json_no_io/index.html index b22709c1d..f6060a89c 100644 --- a/api/macros/json_no_io/index.html +++ b/api/macros/json_no_io/index.html @@ -1,7 +1,7 @@ - JSON_NO_IO - JSON for Modern C++
Skip to content

JSON_NO_IO

#define JSON_NO_IO
+ JSON_NO_IO - JSON for Modern C++      

JSON_NO_IO

#define JSON_NO_IO
 

When defined, headers <cstdio>, <ios>, <iosfwd>, <istream>, and <ostream> are not included and parse functions relying on these headers are excluded. This is relevant for environments where these I/O functions are disallowed for security reasons (e.g., Intel Software Guard Extensions (SGX)).

Default definition

By default, JSON_NO_IO is not defined.

#undef JSON_NO_IO
 

Examples

Example

The code below forces the library not to use the headers <cstdio>, <ios>, <iosfwd>, <istream>, and <ostream>.

#define JSON_NO_IO 1
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

  • Added in version 3.10.0.
\ No newline at end of file +

Version history

  • Added in version 3.10.0.
\ No newline at end of file diff --git a/api/macros/json_noexception/index.html b/api/macros/json_noexception/index.html index 5d7bb57ee..96cfb5c31 100644 --- a/api/macros/json_noexception/index.html +++ b/api/macros/json_noexception/index.html @@ -1,7 +1,7 @@ - JSON_NOEXCEPTION - JSON for Modern C++
Skip to content

JSON_NOEXCEPTION

#define JSON_NOEXCEPTION
+ JSON_NOEXCEPTION - JSON for Modern C++      

JSON_NOEXCEPTION

#define JSON_NOEXCEPTION
 

Exceptions can be switched off by defining the symbol JSON_NOEXCEPTION. When defining JSON_NOEXCEPTION, try is replaced by if (true), catch is replaced by if (false), and throw is replaced by std::abort().

The same effect is achieved by setting the compiler flag -fno-exceptions.

Default definition

By default, the macro is not defined.

#undef JSON_NOEXCEPTION
 

Notes

The explanatory what() string of exceptions is not available for MSVC if exceptions are disabled, see #2824.

Examples

Example

The code below switches off exceptions in the library.

#define JSON_NOEXCEPTION 1
 #include <nlohmann/json.hpp>
 
 ...
-

See also

Version history

Added in version 2.1.0.

\ No newline at end of file +

See also

Version history

Added in version 2.1.0.

\ No newline at end of file diff --git a/api/macros/json_skip_library_version_check/index.html b/api/macros/json_skip_library_version_check/index.html index 4f597292d..ee7065370 100644 --- a/api/macros/json_skip_library_version_check/index.html +++ b/api/macros/json_skip_library_version_check/index.html @@ -1,4 +1,4 @@ - JSON_SKIP_LIBRARY_VERSION_CHECK - JSON for Modern C++
Skip to content

JSON_SKIP_LIBRARY_VERSION_CHECK

#define JSON_SKIP_LIBRARY_VERSION_CHECK
+ JSON_SKIP_LIBRARY_VERSION_CHECK - JSON for Modern C++      

JSON_SKIP_LIBRARY_VERSION_CHECK

#define JSON_SKIP_LIBRARY_VERSION_CHECK
 

When defined, the library will not create a compiler warning when a different version of the library was already included.

Default definition

By default, the macro is not defined.

#undef JSON_SKIP_LIBRARY_VERSION_CHECK
 

Notes

ABI compatibility

Mixing different library versions in the same code can be a problem as the different versions may not be ABI compatible.

Examples

Example

The following warning will be shown in case a different version of the library was already included:

Already included a different version of the library!
-

Version history

Added in version 3.11.0.

\ No newline at end of file +

Version history

Added in version 3.11.0.

\ No newline at end of file diff --git a/api/macros/json_skip_unsupported_compiler_check/index.html b/api/macros/json_skip_unsupported_compiler_check/index.html index d9d5f59d9..67b88341a 100644 --- a/api/macros/json_skip_unsupported_compiler_check/index.html +++ b/api/macros/json_skip_unsupported_compiler_check/index.html @@ -1,7 +1,7 @@ - JSON_SKIP_UNSUPPORTED_COMPILER_CHECK - JSON for Modern C++
Skip to content

JSON_SKIP_UNSUPPORTED_COMPILER_CHECK

#define JSON_SKIP_UNSUPPORTED_COMPILER_CHECK
+ JSON_SKIP_UNSUPPORTED_COMPILER_CHECK - JSON for Modern C++      

JSON_SKIP_UNSUPPORTED_COMPILER_CHECK

#define JSON_SKIP_UNSUPPORTED_COMPILER_CHECK
 

When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used.

Default definition

By default, the macro is not defined.

#undef JSON_SKIP_UNSUPPORTED_COMPILER_CHECK
 

Examples

Example

The code below switches off the check whether the compiler is supported.

#define JSON_SKIP_UNSUPPORTED_COMPILER_CHECK 1
 #include <nlohmann/json.hpp>
 
 ...
-

Version history

Added in version 3.2.0.

\ No newline at end of file +

Version history

Added in version 3.2.0.

\ No newline at end of file diff --git a/api/macros/json_throw_user/index.html b/api/macros/json_throw_user/index.html index 3c6c6d31d..07d2f9858 100644 --- a/api/macros/json_throw_user/index.html +++ b/api/macros/json_throw_user/index.html @@ -1,4 +1,4 @@ - JSON_CATCH_USER, JSON_THROW_USER, JSON_TRY_USER - JSON for Modern C++
Skip to content

JSON_CATCH_USER, JSON_THROW_USER, JSON_TRY_USER

// (1)
+ JSON_CATCH_USER, JSON_THROW_USER, JSON_TRY_USER - JSON for Modern C++      

JSON_CATCH_USER, JSON_THROW_USER, JSON_TRY_USER

// (1)
 #define JSON_CATCH_USER(exception) /* value */
 // (2)
 #define JSON_THROW_USER(exception) /* value */
@@ -21,4 +21,4 @@
      std::abort();}
 
 #include <nlohmann/json.hpp>
-

See also

Version history

  • Added in version 3.1.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.1.0.
\ No newline at end of file diff --git a/api/macros/json_use_global_udls/index.html b/api/macros/json_use_global_udls/index.html index ed41f0c9a..fb2f7533b 100644 --- a/api/macros/json_use_global_udls/index.html +++ b/api/macros/json_use_global_udls/index.html @@ -1,4 +1,4 @@ - JSON_USE_GLOBAL_UDLS - JSON for Modern C++
Skip to content

JSON_USE_GLOBAL_UDLS

#define JSON_USE_GLOBAL_UDLS /* value */
+ JSON_USE_GLOBAL_UDLS - JSON for Modern C++      

JSON_USE_GLOBAL_UDLS

#define JSON_USE_GLOBAL_UDLS /* value */
 

When defined to 1, the user-defined string literals (UDLs) are placed into the global namespace instead of nlohmann::literals::json_literals.

Default definition

The default value is 1.

#define JSON_USE_GLOBAL_UDLS 1
 

When the macro is not defined, the library will define it to its default value.

Notes

Future behavior change

The user-defined string literals will be removed from the global namespace in the next major release of the library.

To prepare existing code, define JSON_USE_GLOBAL_UDLS to 0 and bring the string literals into scope where needed. Refer to any of the string literals for details.

CMake option

The placement of user-defined string literals can also be controlled with the CMake option JSON_GlobalUDLs (ON by default) which defines JSON_USE_GLOBAL_UDLS accordingly.

Examples

Example 1: Default behavior

The code below shows the default behavior using the _json UDL.

#include <nlohmann/json.hpp>
 
@@ -29,4 +29,4 @@
     std::cout << j << std::endl;
 }
 

Output:

42
-

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/macros/json_use_implicit_conversions/index.html b/api/macros/json_use_implicit_conversions/index.html index bcca6448c..aa9314f5f 100644 --- a/api/macros/json_use_implicit_conversions/index.html +++ b/api/macros/json_use_implicit_conversions/index.html @@ -1,7 +1,7 @@ - JSON_USE_IMPLICIT_CONVERSIONS - JSON for Modern C++
Skip to content

JSON_USE_IMPLICIT_CONVERSIONS

#define JSON_USE_IMPLICIT_CONVERSIONS /* value */
+ JSON_USE_IMPLICIT_CONVERSIONS - JSON for Modern C++      

JSON_USE_IMPLICIT_CONVERSIONS

#define JSON_USE_IMPLICIT_CONVERSIONS /* value */
 

When defined to 0, implicit conversions are switched off. By default, implicit conversions are switched on. The value directly affects operator ValueType.

Default definition

By default, implicit conversions are enabled.

#define JSON_USE_IMPLICIT_CONVERSIONS 1
 

Notes

Future behavior change

Implicit conversions will be switched off by default in the next major release of the library.

You can prepare existing code by already defining JSON_USE_IMPLICIT_CONVERSIONS to 0 and replace any implicit conversions with calls to get.

CMake option

Implicit conversions can also be controlled with the CMake option JSON_ImplicitConversions (ON by default) which defines JSON_USE_IMPLICIT_CONVERSIONS accordingly.

Examples

Example

This is an example for an implicit conversion:

json j = "Hello, world!";
 std::string s = j;
 

When JSON_USE_IMPLICIT_CONVERSIONS is defined to 0, the code above does no longer compile. Instead, it must be written like this:

json j = "Hello, world!";
 auto s = j.template get<std::string>();
-

See also

Version history

  • Added in version 3.9.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.9.0.
\ No newline at end of file diff --git a/api/macros/json_use_legacy_discarded_value_comparison/index.html b/api/macros/json_use_legacy_discarded_value_comparison/index.html index bdd67e4d5..636999573 100644 --- a/api/macros/json_use_legacy_discarded_value_comparison/index.html +++ b/api/macros/json_use_legacy_discarded_value_comparison/index.html @@ -1,7 +1,7 @@ - JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON - JSON for Modern C++
Skip to content

JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON

#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON /* value */
+ JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON - JSON for Modern C++      

JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON

#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON /* value */
 

This macro enables the (incorrect) legacy comparison behavior of discarded JSON values. Possible values are 1 to enable or 0 to disable (default).

When enabled, comparisons involving at least one discarded JSON value yield results as follows:

Operator Result
== false
!= true
< false
<= true
>= true
> false

Otherwise, comparisons involving at least one discarded JSON value always yield false.

Default definition

The default value is 0.

#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
 

When the macro is not defined, the library will define it to its default value.

Notes

Inconsistent behavior in C++20 and beyond

When targeting C++20 or above, enabling the legacy comparison behavior is strongly discouraged.

  • The 3-way comparison operator (<=>) will always give the correct result (std::partial_ordering::unordered) regardless of the value of JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON.
  • Overloads for the equality and relational operators emulate the legacy behavior.

Code outside your control may use either 3-way comparison or the equality and relational operators, resulting in inconsistent and unpredictable behavior.

See operator<=> for more information on 3-way comparison.

Deprecation

The legacy comparison behavior is deprecated and may be removed in a future major version release.

New code should not depend on it and existing code should try to remove or rewrite expressions relying on it.

CMake option

Legacy comparison can also be controlled with the CMake option JSON_LegacyDiscardedValueComparison (OFF by default) which defines JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON accordingly.

Examples

Example

The code below switches on the legacy discarded value comparison behavior in the library.

#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 1
 #include <nlohmann/json.hpp>
 
 ...
-

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.0.
\ No newline at end of file diff --git a/api/macros/nlohmann_define_derived_type/index.html b/api/macros/nlohmann_define_derived_type/index.html index 9549d304e..12a912038 100644 --- a/api/macros/nlohmann_define_derived_type/index.html +++ b/api/macros/nlohmann_define_derived_type/index.html @@ -1,4 +1,4 @@ - NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE - JSON for Modern C++
Skip to content

NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE

// (1)
+ NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE - JSON for Modern C++      

NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE

// (1)
 #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(type, base_type, member...)
 // (2)
 #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(type, base_type, member...)
@@ -86,4 +86,4 @@
     "Ba": 23,
     "Bb": 42
 }
-

Notes:

  • A and B are default-constructible. This is a requirement for using the macro.
  • A has private members and is not a derived class. Hence, macro NLOHMANN_DEFINE_TYPE_INTRUSIVE is used.
  • As B is a derived class, NLOHMANN_DEFINE_TYPE_INTRUSIVE is not applicable, but NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE must be used.
  • The macro NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE is used inside the class use as NLOHMANN_DEFINE_TYPE_INTRUSIVE.

See also

Version history

  1. Added in version 3.11.x.
  2. Added in version 3.11.x.
  3. Added in version 3.11.x.
  4. Added in version 3.11.x.
  5. Added in version 3.11.x.
  6. Added in version 3.11.x.
\ No newline at end of file +

Notes:

  • A and B are default-constructible. This is a requirement for using the macro.
  • A has private members and is not a derived class. Hence, macro NLOHMANN_DEFINE_TYPE_INTRUSIVE is used.
  • As B is a derived class, NLOHMANN_DEFINE_TYPE_INTRUSIVE is not applicable, but NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE must be used.
  • The macro NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE is used inside the class use as NLOHMANN_DEFINE_TYPE_INTRUSIVE.

See also

Version history

  1. Added in version 3.11.x.
  2. Added in version 3.11.x.
  3. Added in version 3.11.x.
  4. Added in version 3.11.x.
  5. Added in version 3.11.x.
  6. Added in version 3.11.x.
\ No newline at end of file diff --git a/api/macros/nlohmann_define_type_intrusive/index.html b/api/macros/nlohmann_define_type_intrusive/index.html index 81918c8b4..d1ceb14ee 100644 --- a/api/macros/nlohmann_define_type_intrusive/index.html +++ b/api/macros/nlohmann_define_type_intrusive/index.html @@ -1,4 +1,4 @@ - NLOHMANN_DEFINE_TYPE_INTRUSIVE, NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE - JSON for Modern C++
Skip to content

NLOHMANN_DEFINE_TYPE_INTRUSIVE, NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE

#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(type, member...)              // (1)
+ NLOHMANN_DEFINE_TYPE_INTRUSIVE, NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE - JSON for Modern C++      

NLOHMANN_DEFINE_TYPE_INTRUSIVE, NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE

#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(type, member...)              // (1)
 #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(type, member...) // (2)
 #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(type, member...) // (3)
 

These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as serialization and want to use the member variable names as object keys in that object. The macro is to be defined inside the class/struct to create code for. Unlike NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE, it can access private members. The first parameter is the name of the class/struct, and all remaining parameters name the members.

  1. Will use at during deserialization and will throw out_of_range.403 if a key is missing in the JSON object.
  2. Will use value during deserialization and fall back to the default value for the respective type of the member variable if a key in the JSON object is missing. The generated from_json() function default constructs an object and uses its values as the defaults when calling the value function.
  3. Only defines the serialization. Useful in cases when the type does not have a default constructor and only serialization in required.

Summary:

Need access to private members Need only de-serialization Allow missing values when de-serializing macro
NLOHMANN_DEFINE_TYPE_INTRUSIVE
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT
NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE

Parameters

type (in)
name of the type (class, struct) to serialize/deserialize
member (in)
name of the member variable to serialize/deserialize; up to 64 members can be given as comma-separated list

Default definition

The macros add two friend functions to the class which take care of the serialization and deserialization:

template<typename BasicJsonType>
@@ -291,4 +291,4 @@
     json j = p;
     std::cout << "serialization: " << j << std::endl;
 }
-

See also

Version history

  1. Added in version 3.9.0.
  2. Added in version 3.11.0.
  3. Added in version 3.11.3.
\ No newline at end of file +

See also

Version history

  1. Added in version 3.9.0.
  2. Added in version 3.11.0.
  3. Added in version 3.11.3.
\ No newline at end of file diff --git a/api/macros/nlohmann_define_type_non_intrusive/index.html b/api/macros/nlohmann_define_type_non_intrusive/index.html index d14381b92..ac040ec1d 100644 --- a/api/macros/nlohmann_define_type_non_intrusive/index.html +++ b/api/macros/nlohmann_define_type_non_intrusive/index.html @@ -1,4 +1,4 @@ - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE - JSON for Modern C++
Skip to content

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE

#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(type, member...)              // (1)
+ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE - JSON for Modern C++      

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT, NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE

#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(type, member...)              // (1)
 #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(type, member...) // (2)
 #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(type, member...) // (3)
 

These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as serialization and want to use the member variable names as object keys in that object. The macro is to be defined outside the class/struct to create code for, but inside its namespace. Unlike NLOHMANN_DEFINE_TYPE_INTRUSIVE, it cannot access private members. The first parameter is the name of the class/struct, and all remaining parameters name the members.

  1. Will use at during deserialization and will throw out_of_range.403 if a key is missing in the JSON object.
  2. Will use value during deserialization and fall back to the default value for the respective type of the member variable if a key in the JSON object is missing. The generated from_json() function default constructs an object and uses its values as the defaults when calling the value function.
  3. Only defines the serialization. Useful in cases when the type does not have a default constructor and only serialization in required.

Summary:

Need access to private members Need only de-serialization Allow missing values when de-serializing macro
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE

Parameters

type (in)
name of the type (class, struct) to serialize/deserialize
member (in)
name of the (public) member variable to serialize/deserialize; up to 64 members can be given as comma-separated list

Default definition

The macros add two functions to the namespace which take care of the serialization and deserialization:

template<typename BasicJsonType>
@@ -259,4 +259,4 @@
     json j = p;
     std::cout << "serialization: " << j << std::endl;
 }
-

See also

Version history

  1. Added in version 3.9.0.
  2. Added in version 3.11.0.
  3. Added in version 3.11.3.
\ No newline at end of file +

See also

Version history

  1. Added in version 3.9.0.
  2. Added in version 3.11.0.
  3. Added in version 3.11.3.
\ No newline at end of file diff --git a/api/macros/nlohmann_json_namespace/index.html b/api/macros/nlohmann_json_namespace/index.html index 7d8e25433..045b7a3b1 100644 --- a/api/macros/nlohmann_json_namespace/index.html +++ b/api/macros/nlohmann_json_namespace/index.html @@ -1,4 +1,4 @@ - NLOHMANN_JSON_NAMESPACE - JSON for Modern C++
Skip to content

NLOHMANN_JSON_NAMESPACE

#define NLOHMANN_JSON_NAMESPACE /* value */
+ NLOHMANN_JSON_NAMESPACE - JSON for Modern C++      

NLOHMANN_JSON_NAMESPACE

#define NLOHMANN_JSON_NAMESPACE /* value */
 

This macro evaluates to the full name of the nlohmann namespace.

Default definition

The default value consists of the root namespace (nlohmann) and an inline ABI namespace. See nlohmann Namespace for details.

When the macro is not defined, the library will define it to its default value. Overriding this value has no effect on the library.

Examples

Example

The example shows how to use NLOHMANN_JSON_NAMESPACE instead of just nlohmann, as well as how to output the value of NLOHMANN_JSON_NAMESPACE.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -14,4 +14,4 @@
     std::cout << QUOTE(NLOHMANN_JSON_NAMESPACE) << std::endl;
 }
 

Output:

nlohmann::json_abi_v3_11_3
-

See also

Version history

  • Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
\ No newline at end of file diff --git a/api/macros/nlohmann_json_namespace_begin/index.html b/api/macros/nlohmann_json_namespace_begin/index.html index 5b2262453..c809dfe46 100644 --- a/api/macros/nlohmann_json_namespace_begin/index.html +++ b/api/macros/nlohmann_json_namespace_begin/index.html @@ -1,4 +1,4 @@ - NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END - JSON for Modern C++
Skip to content

NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END

#define NLOHMANN_JSON_NAMESPACE_BEGIN /* value */  // (1)
+ NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END - JSON for Modern C++      

NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END

#define NLOHMANN_JSON_NAMESPACE_BEGIN /* value */  // (1)
 #define NLOHMANN_JSON_NAMESPACE_END   /* value */  // (2)
 

These macros can be used to open and close the nlohmann namespace. See nlohmann Namespace for details.

  1. Opens the namespace.
  2. Closes the namespace.

Default definition

The default definitions open and close the nlohmann namespace. The precise definition of [NLOHMANN_JSON_NAMESPACE_BEGIN] varies as described here.

  1. Default definition of NLOHMANN_JSON_NAMESPACE_BEGIN:

    namespace nlohmann
     {
    @@ -40,4 +40,4 @@
         std::cout << j << std::endl;
     }
     

    Output:

    [1,null]
    -

    See also

    Version history

    • Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
\ No newline at end of file diff --git a/api/macros/nlohmann_json_namespace_no_version/index.html b/api/macros/nlohmann_json_namespace_no_version/index.html index b961e9f54..3a05bd385 100644 --- a/api/macros/nlohmann_json_namespace_no_version/index.html +++ b/api/macros/nlohmann_json_namespace_no_version/index.html @@ -1,4 +1,4 @@ - NLOHMANN_JSON_NAMESPACE_NO_VERSION - JSON for Modern C++
Skip to content

NLOHMANN_JSON_NAMESPACE_NO_VERSION

#define NLOHMANN_JSON_NAMESPACE_NO_VERSION /* value */
+ NLOHMANN_JSON_NAMESPACE_NO_VERSION - JSON for Modern C++      

NLOHMANN_JSON_NAMESPACE_NO_VERSION

#define NLOHMANN_JSON_NAMESPACE_NO_VERSION /* value */
 

If defined to 1, the version component is omitted from the inline namespace. See nlohmann Namespace for details.

Default definition

The default value is 0.

#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
 

When the macro is not defined, the library will define it to its default value.

Examples

Example

The example shows how to use NLOHMANN_JSON_NAMESPACE_NO_VERSION to disable the version component of the inline namespace.

#include <iostream>
 
@@ -14,4 +14,4 @@
     std::cout << QUOTE(NLOHMANN_JSON_NAMESPACE) << std::endl;
 }
 

Output:

nlohmann::json_abi
-

See also

Version history

  • Added in version 3.11.2.
\ No newline at end of file +

See also

Version history

  • Added in version 3.11.2.
\ No newline at end of file diff --git a/api/macros/nlohmann_json_serialize_enum/index.html b/api/macros/nlohmann_json_serialize_enum/index.html index a76210dd2..291987772 100644 --- a/api/macros/nlohmann_json_serialize_enum/index.html +++ b/api/macros/nlohmann_json_serialize_enum/index.html @@ -1,4 +1,4 @@ - NLOHMANN_JSON_SERIALIZE_ENUM - JSON for Modern C++
Skip to content

NLOHMANN_JSON_SERIALIZE_ENUM

#define NLOHMANN_JSON_SERIALIZE_ENUM(type, conversion...)
+ NLOHMANN_JSON_SERIALIZE_ENUM - JSON for Modern C++      

NLOHMANN_JSON_SERIALIZE_ENUM

#define NLOHMANN_JSON_SERIALIZE_ENUM(type, conversion...)
 

By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be undefined or a different enum value than was originally intended.

The NLOHMANN_JSON_SERIALIZE_ENUM allows to define a user-defined serialization for every enumerator.

Parameters

type (in)
name of the enum to serialize/deserialize
conversion (in)
a pair of an enumerator and a JSON serialization; arbitrary pairs can be given as a comma-separated list

Default definition

The macro adds two functions to the namespace which take care of the serialization and deserialization:

template<typename BasicJsonType>
 inline void to_json(BasicJsonType& j, const type& e);
 template<typename BasicJsonType>
@@ -101,4 +101,4 @@
 

Output:

0 -> "red"
 "rot" -> 0
 "red" -> 0
-

See also

Version history

Added in version 3.4.0.

\ No newline at end of file +

See also

Version history

Added in version 3.4.0.

\ No newline at end of file diff --git a/api/macros/nlohmann_json_version_major/index.html b/api/macros/nlohmann_json_version_major/index.html index 5454c5a25..2bf09d7f7 100644 --- a/api/macros/nlohmann_json_version_major/index.html +++ b/api/macros/nlohmann_json_version_major/index.html @@ -1,4 +1,4 @@ - NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH - JSON for Modern C++
Skip to content

NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH

#define NLOHMANN_JSON_VERSION_MAJOR /* value */
+ NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH - JSON for Modern C++      

NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH

#define NLOHMANN_JSON_VERSION_MAJOR /* value */
 #define NLOHMANN_JSON_VERSION_MINOR /* value */
 #define NLOHMANN_JSON_VERSION_PATCH /* value */
 

These macros are defined by the library and contain the version numbers according to Semantic Versioning 2.0.0.

Default definition

The macros are defined according to the current library version.

Examples

Example

The example below shows how NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, and NLOHMANN_JSON_VERSION_PATCH are defined by the library.

#include <iostream>
@@ -14,4 +14,4 @@
               << NLOHMANN_JSON_VERSION_PATCH << std::endl;
 }
 

Output:

JSON for Modern C++ version 3.11.3
-

See also

Version history

  • Added in version 3.1.0.
\ No newline at end of file +

See also

Version history

  • Added in version 3.1.0.
\ No newline at end of file diff --git a/api/operator_gtgt/index.html b/api/operator_gtgt/index.html index a4506a87a..aabc45655 100644 --- a/api/operator_gtgt/index.html +++ b/api/operator_gtgt/index.html @@ -1,4 +1,4 @@ - operator>>(basic_json) - JSON for Modern C++
Skip to content

nlohmann::operator>>(basic_json)

std::istream& operator>>(std::istream& i, basic_json& j);
+ operator>>(basic_json) - JSON for Modern C++      

nlohmann::operator>>(basic_json)

std::istream& operator>>(std::istream& i, basic_json& j);
 

Deserializes an input stream to a JSON value.

Parameters

i (in, out)
input stream to read a serialized JSON value from
j (in, out)
JSON value to write the deserialized input to

Return value

the stream i

Exceptions

Complexity

Linear in the length of the input. The parser is a predictive LL(1) parser.

Notes

A UTF-8 byte order mark is silently ignored.

Deprecation

This function replaces function std::istream& operator<<(basic_json& j, std::istream& i) which has been deprecated in version 3.0.0. It will be removed in version 4.0.0. Please replace calls like j << i; with i >> j;.

Examples

Example

The example below shows how a JSON value is constructed by reading a serialization from a stream.

#include <iostream>
 #include <iomanip>
 #include <sstream>
@@ -38,4 +38,4 @@
   "number": 23,
   "string": "Hello, world!"
 }
-

See also

  • accept - check if the input is valid JSON
  • parse - deserialize from a compatible input

Version history

  • Added in version 1.0.0. Deprecated in version 3.0.0.
\ No newline at end of file +

See also

  • accept - check if the input is valid JSON
  • parse - deserialize from a compatible input

Version history

  • Added in version 1.0.0. Deprecated in version 3.0.0.
\ No newline at end of file diff --git a/api/operator_literal_json/index.html b/api/operator_literal_json/index.html index 6f0d24817..41dba6a74 100644 --- a/api/operator_literal_json/index.html +++ b/api/operator_literal_json/index.html @@ -1,4 +1,4 @@ - operator""_json - JSON for Modern C++
Skip to content

nlohmann::operator""_json

json operator ""_json(const char* s, std::size_t n);
+ operator""_json - JSON for Modern C++      

nlohmann::operator""_json

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

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.

It is recommended to bring the operator into scope using any of the following lines:

using nlohmann::literals::operator ""_json;
 using namespace nlohmann::literals;
 using namespace nlohmann::json_literals;
@@ -21,4 +21,4 @@
   "answer": 42,
   "hello": "world"
 }
-

Version history

  • Added in version 1.0.0.
  • Moved to namespace nlohmann::literals::json_literals in 3.11.0.
\ No newline at end of file +

Version history

  • Added in version 1.0.0.
  • Moved to namespace nlohmann::literals::json_literals in 3.11.0.
\ No newline at end of file diff --git a/api/operator_literal_json_pointer/index.html b/api/operator_literal_json_pointer/index.html index a00fc108c..1389aa8ef 100644 --- a/api/operator_literal_json_pointer/index.html +++ b/api/operator_literal_json_pointer/index.html @@ -1,4 +1,4 @@ - operator""_json_pointer - JSON for Modern C++
Skip to content

nlohmann::operator""_json_pointer

json_pointer operator ""_json_pointer(const char* s, std::size_t n);
+ operator""_json_pointer - JSON for Modern C++      

nlohmann::operator""_json_pointer

json_pointer operator ""_json_pointer(const char* s, std::size_t n);
 

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.

It is recommended to bring the operator into scope using any of the following lines:

using nlohmann::literals::operator ""_json_pointer;
 using namespace nlohmann::literals;
 using namespace nlohmann::json_literals;
@@ -19,4 +19,4 @@
     std::cout << std::setw(2) << val << '\n';
 }
 

Output:

"world"
-

See also

Version history

  • Added in version 2.0.0.
  • Moved to namespace nlohmann::literals::json_literals in 3.11.0.
\ No newline at end of file +

See also

Version history

  • Added in version 2.0.0.
  • Moved to namespace nlohmann::literals::json_literals in 3.11.0.
\ No newline at end of file diff --git a/api/operator_ltlt/index.html b/api/operator_ltlt/index.html index e7833cb01..9d2892b4b 100644 --- a/api/operator_ltlt/index.html +++ b/api/operator_ltlt/index.html @@ -1,4 +1,4 @@ - operator<<(basic_json), operator<<(json_pointer) - JSON for Modern C++
Skip to content

nlohmann::operator<<(basic_json), nlohmann::operator<<(json_pointer)

std::ostream& operator<<(std::ostream& o, const basic_json& j);      // (1)
+ operator<<(basic_json), operator<<(json_pointer) - JSON for Modern C++      

nlohmann::operator<<(basic_json), nlohmann::operator<<(json_pointer)

std::ostream& operator<<(std::ostream& o, const basic_json& j);      // (1)
 
 std::ostream& operator<<(std::ostream& o, const json_pointer& ptr);  // (2)
 
  1. Serialize the given JSON value j to the output stream o. The JSON value will be serialized using the dump member function.
    • The indentation of the output can be controlled with the member variable width of the output stream o. For instance, using the manipulator std::setw(4) on o sets the indentation level to 4 and the serialization result is the same as calling dump(4).
    • The indentation character can be controlled with the member variable fill of the output stream o. For instance, the manipulator std::setfill('\\t') sets indentation to use a tab character rather than the default space character.
  2. Write a string representation of the given JSON pointer ptr to the output stream o. The string representation is obtained using the to_string member function.

Parameters

o (in, out)
stream to write to
j (in)
JSON value to serialize
ptr (in)
JSON pointer to write

Return value

the stream o

Exceptions

  1. Throws type_error.316 if a string stored inside the JSON value is not UTF-8 encoded. Note that unlike the dump member functions, no error_handler can be set.
  2. None.

Complexity

Linear.

Notes

Deprecation

Function std::ostream& operator<<(std::ostream& o, const basic_json& j) replaces function std::ostream& operator>>(const basic_json& j, std::ostream& o) which has been deprecated in version 3.0.0. It will be removed in version 4.0.0. Please replace calls like j >> o; with o << j;.

Examples

Example: (1) serialize JSON value to stream

The example below shows the serialization with different parameters to width to adjust the indentation level.

#include <iostream>
@@ -57,4 +57,4 @@
     std::cout << ptr << std::endl;
 }
 

Output:

/foo/bar/baz
-

Version history

  1. Added in version 1.0.0. Added support for indentation character and deprecated std::ostream& operator>>(const basic_json& j, std::ostream& o) in version 3.0.0.
  2. Added in version 3.11.0.
\ No newline at end of file +

Version history

  1. Added in version 1.0.0. Added support for indentation character and deprecated std::ostream& operator>>(const basic_json& j, std::ostream& o) in version 3.0.0.
  2. Added in version 3.11.0.
\ No newline at end of file diff --git a/api/ordered_json/index.html b/api/ordered_json/index.html index 2d8093110..3ab782177 100644 --- a/api/ordered_json/index.html +++ b/api/ordered_json/index.html @@ -1,4 +1,4 @@ - ordered_json - JSON for Modern C++
Skip to content

nlohmann::ordered_json

using ordered_json = basic_json<ordered_map>;
+ ordered_json - JSON for Modern C++      

nlohmann::ordered_json

using ordered_json = basic_json<ordered_map>;
 

This type preserves the insertion order of object keys.

Iterator invalidation

The type is based on ordered_map which in turn uses a std::vector to store object elements. Therefore, adding object elements can yield a reallocation in which case all iterators (including the end() iterator) and all references to the elements are invalidated. Also, any iterator or reference after the insertion point will point to the same index which is now a different value.

Examples

Example

The example below demonstrates how ordered_json preserves the insertion order of object keys.

#include <iostream>
 #include <nlohmann/json.hpp>
 
@@ -18,4 +18,4 @@
   "two": 2,
   "three": 3
 }
-

See also

Version history

Since version 3.9.0.

\ No newline at end of file +

See also

Version history

Since version 3.9.0.

\ No newline at end of file diff --git a/api/ordered_map/index.html b/api/ordered_map/index.html index 12c805d38..b29369fb0 100644 --- a/api/ordered_map/index.html +++ b/api/ordered_map/index.html @@ -1,4 +1,4 @@ - ordered_map - JSON for Modern C++
Skip to content

nlohmann::ordered_map

template<class Key, class T, class IgnoredLess = std::less<Key>,
+ ordered_map - JSON for Modern C++      

nlohmann::ordered_map

template<class Key, class T, class IgnoredLess = std::less<Key>,
          class Allocator = std::allocator<std::pair<const Key, T>>>
 struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>;
 

A minimal map-like container that preserves insertion order for use within nlohmann::ordered_json (nlohmann::basic_json<ordered_map>).

Template parameters

Key
key type
T
mapped type
IgnoredLess
comparison function (ignored and only added to ensure compatibility with std::map)
Allocator
allocator type

Iterator invalidation

The type uses a std::vector to store object elements. Therefore, adding elements can yield a reallocation in which case all iterators (including the end() iterator) and all references to the elements are invalidated.

Member types

  • key_type - key type (Key)
  • mapped_type - mapped type (T)
  • Container - base container type (std::vector<std::pair<const Key, T>, Allocator>)
  • iterator
  • const_iterator
  • size_type
  • value_type
  • key_compare - key comparison function
    std::equal_to<Key>  // until C++14
    @@ -51,4 +51,4 @@
     m_std = { one:eins three:drei two:zwei }
     m_ordered = { two:zwei three:drei one:eins }
     m_std = { one:eins three:drei two:zwei }
    -

    See also

    Version history

\ No newline at end of file +

See also

Version history

\ No newline at end of file diff --git a/assets/external/fonts.googleapis.com/css.61a430c9.css b/assets/external/fonts.googleapis.com/css.61a430c9.css deleted file mode 100644 index 9a85686fc..000000000 --- a/assets/external/fonts.googleapis.com/css.61a430c9.css +++ /dev/null @@ -1,756 +0,0 @@ -/* cyrillic-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PszQMgo-8.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PsxAMgo-8.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PswwMgo-8.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* vietnamese */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PszwMgo-8.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PszgMgo-8.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PswAMg.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PszQMgo-8.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PsxAMgo-8.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PswwMgo-8.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* vietnamese */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PszwMgo-8.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PszgMgo-8.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: italic; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbp2o-flEEny0FZhsfKu5WU4xD-IQ-PuZJJXxfpAO-LfjGbsVNLG7DGdF6OZ1PswAMg.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* vietnamese */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 400; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* vietnamese */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'JetBrains Mono'; - font-style: normal; - font-weight: 700; - font-display: fallback; - src: url(../fonts.gstatic.com/s/jetbrainsmono/v20/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaWzU.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaWzU.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaWzU.woff2) format('woff2'); - unicode-range: U+1F00-1FFF; -} -/* greek */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaWzU.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* math */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaWzU.woff2) format('woff2'); - unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF; -} -/* symbols */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaWzU.woff2) format('woff2'); - unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF; -} -/* vietnamese */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaWzU.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaWzU.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnka.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaWzU.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaWzU.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaWzU.woff2) format('woff2'); - unicode-range: U+1F00-1FFF; -} -/* greek */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaWzU.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* math */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaWzU.woff2) format('woff2'); - unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF; -} -/* symbols */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaWzU.woff2) format('woff2'); - unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF; -} -/* vietnamese */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaWzU.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaWzU.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnka.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkC3kaWzU.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkAnkaWzU.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCnkaWzU.woff2) format('woff2'); - unicode-range: U+1F00-1FFF; -} -/* greek */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaWzU.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* math */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaWzU.woff2) format('woff2'); - unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF; -} -/* symbols */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaWzU.woff2) format('woff2'); - unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF; -} -/* vietnamese */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCXkaWzU.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaWzU.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnka.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBGEe.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBGEe.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBGEe.woff2) format('woff2'); - unicode-range: U+1F00-1FFF; -} -/* greek */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBGEe.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* math */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBGEe.woff2) format('woff2'); - unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF; -} -/* symbols */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBGEe.woff2) format('woff2'); - unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF; -} -/* vietnamese */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBGEe.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBGEe.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBGEe.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBGEe.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBGEe.woff2) format('woff2'); - unicode-range: U+1F00-1FFF; -} -/* greek */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBGEe.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* math */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBGEe.woff2) format('woff2'); - unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF; -} -/* symbols */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBGEe.woff2) format('woff2'); - unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF; -} -/* vietnamese */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBGEe.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBGEe.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} -/* cyrillic-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBGEe.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; -} -/* cyrillic */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBGEe.woff2) format('woff2'); - unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -/* greek-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBGEe.woff2) format('woff2'); - unicode-range: U+1F00-1FFF; -} -/* greek */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBGEe.woff2) format('woff2'); - unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; -} -/* math */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBGEe.woff2) format('woff2'); - unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF; -} -/* symbols */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBGEe.woff2) format('woff2'); - unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF; -} -/* vietnamese */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBGEe.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBGEe.woff2) format('woff2'); - unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - font-stretch: 100%; - font-display: fallback; - src: url(../fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; -} diff --git a/assets/external/img.shields.io/cocoapods/v/nlohmann_json.svg b/assets/external/img.shields.io/cocoapods/v/nlohmann_json.svg deleted file mode 100644 index 500bc3158..000000000 --- a/assets/external/img.shields.io/cocoapods/v/nlohmann_json.svg +++ /dev/null @@ -1 +0,0 @@ -pod: v3.7.3podv3.7.3 \ No newline at end of file diff --git a/assets/external/img.shields.io/conda/v/conda-forge/nlohmann_json.svg b/assets/external/img.shields.io/conda/v/conda-forge/nlohmann_json.svg deleted file mode 100644 index d6b279de1..000000000 --- a/assets/external/img.shields.io/conda/v/conda-forge/nlohmann_json.svg +++ /dev/null @@ -1 +0,0 @@ -conda | conda-forge: v3.11.3conda | conda-forgev3.11.3 \ No newline at end of file diff --git a/community/code_of_conduct/index.html b/community/code_of_conduct/index.html index 9b1165197..d9a4cd64b 100644 --- a/community/code_of_conduct/index.html +++ b/community/code_of_conduct/index.html @@ -1 +1 @@ - Code of Conduct - JSON for Modern C++
Skip to content

Contributor Covenant Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

Our Standards

Examples of behavior that contributes to a positive environment for our community include:

  • Demonstrating empathy and kindness toward other people
  • Being respectful of differing opinions, viewpoints, and experiences
  • Giving and gracefully accepting constructive feedback
  • Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
  • Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

  • The use of sexualized language or imagery, and sexual attention or advances of any kind
  • Trolling, insulting or derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or email address, without their explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting

Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mail@nlohmann.me. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the community.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

\ No newline at end of file + Code of Conduct - JSON for Modern C++
Skip to content

Contributor Covenant Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

Our Standards

Examples of behavior that contributes to a positive environment for our community include:

  • Demonstrating empathy and kindness toward other people
  • Being respectful of differing opinions, viewpoints, and experiences
  • Giving and gracefully accepting constructive feedback
  • Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
  • Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

  • The use of sexualized language or imagery, and sexual attention or advances of any kind
  • Trolling, insulting or derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or email address, without their explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting

Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mail@nlohmann.me. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the community.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

\ No newline at end of file diff --git a/community/contribution_guidelines/index.html b/community/contribution_guidelines/index.html index 0929b4538..bd2e51b49 100644 --- a/community/contribution_guidelines/index.html +++ b/community/contribution_guidelines/index.html @@ -1,8 +1,8 @@ - Contribution Guidelines - JSON for Modern C++
Skip to content

Contribution Guidelines

Thank you for your interest in contributing to this project! What began as an exercise to explore the exciting features of C++11 has evolved into a widely-used JSON library. I truly appreciate all the contributions from the community, whether it's proposing features, identifying bugs, or fixing mistakes! To ensure that our collaboration is efficient and effective, please follow these guidelines.

Feel free to discuss or suggest improvements to this document by submitting a pull request.

Ways to Contribute

There are multiple ways to contribute.

Reporting an issue

Please create an issue, assuming one does not already exist, and describe your concern. Note you need a GitHub account for this.

Clearly describe the issue:

  • If it is a bug, please describe how to reproduce it. If possible, attach a complete example which demonstrates the error. Please also state what you expected to happen instead of the error.
  • If you propose a change or addition, try to give an example how the improved code could look like or how to use it.
  • If you found a compilation error, please tell us which compiler (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.

Please stick to the provided issue template bug report if possible.

Reporting a security vulnerability

You can report a security vulnerability according to our security policy.

Discussing a new feature

For questions, feature or support requests, please open a discussion. If you find a proposed answer satisfactory, please use the "Mark as answer" button to make it easier for readers to see what helped and for the community to filter for open questions.

Proposing a fix or an improvement

Join an ongoing discussion or comment on an existing issue before starting to code. This can help to avoid duplicate efforts or other frustration during the later review.

Create a pull request against the develop branch and follow the pull request template. In particular,

  • describe the changes in detail, both the what and why,
  • reference existing issues where applicable,
  • add tests to maintain 100% test coverage,
  • update the documentation as needed, and
  • ensure the source code is amalgamated.

We describe all points in detail below.

All contributions (including pull requests) must agree to the Developer Certificate of Origin (DCO) version 1.1. This is exactly the same one created and used by the Linux kernel developers and posted on http://developercertificate.org/. This is a developer's certification that he or she has the right to submit the patch for inclusion into the project.

How to...

Describe your changes

This library is primarily maintained as a spare-time project. As such, I can not make any guarantee how quickly changes are merged and released. Therefore, it is very important to make the review as smooth as possible by explaining not only what you changed, but why. This rationale can be very valuable down the road when improvements or bugs are discussed years later.

Reference existing issues

Link a pull request to an issue to clarify that a fix is forthcoming and which issue can be closed after merging. Only few cases (e.g., fixing typos) don’t require prior discussions.

Write tests

The library has an extensive test suite that currently covers 100 % of the library's code. These test are crucial to maintain API stability and give future contributors confidence that they do not accidentally break things. As Titus Winters aptly put it:

If you liked it, you should have put a test on it.

Run the tests

First, ensure the test suite runs before making any changes:

$ cmake -S. -B build
+ Contribution Guidelines - JSON for Modern C++      

Contribution Guidelines

Thank you for your interest in contributing to this project! What began as an exercise to explore the exciting features of C++11 has evolved into a widely-used JSON library. I truly appreciate all the contributions from the community, whether it's proposing features, identifying bugs, or fixing mistakes! To ensure that our collaboration is efficient and effective, please follow these guidelines.

Feel free to discuss or suggest improvements to this document by submitting a pull request.

Ways to Contribute

There are multiple ways to contribute.

Reporting an issue

Please create an issue, assuming one does not already exist, and describe your concern. Note you need a GitHub account for this.

Clearly describe the issue:

  • If it is a bug, please describe how to reproduce it. If possible, attach a complete example which demonstrates the error. Please also state what you expected to happen instead of the error.
  • If you propose a change or addition, try to give an example how the improved code could look like or how to use it.
  • If you found a compilation error, please tell us which compiler (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.

Please stick to the provided issue template bug report if possible.

Reporting a security vulnerability

You can report a security vulnerability according to our security policy.

Discussing a new feature

For questions, feature or support requests, please open a discussion. If you find a proposed answer satisfactory, please use the "Mark as answer" button to make it easier for readers to see what helped and for the community to filter for open questions.

Proposing a fix or an improvement

Join an ongoing discussion or comment on an existing issue before starting to code. This can help to avoid duplicate efforts or other frustration during the later review.

Create a pull request against the develop branch and follow the pull request template. In particular,

  • describe the changes in detail, both the what and why,
  • reference existing issues where applicable,
  • add tests to maintain 100% test coverage,
  • update the documentation as needed, and
  • ensure the source code is amalgamated.

We describe all points in detail below.

All contributions (including pull requests) must agree to the Developer Certificate of Origin (DCO) version 1.1. This is exactly the same one created and used by the Linux kernel developers and posted on http://developercertificate.org/. This is a developer's certification that he or she has the right to submit the patch for inclusion into the project.

How to...

Describe your changes

This library is primarily maintained as a spare-time project. As such, I can not make any guarantee how quickly changes are merged and released. Therefore, it is very important to make the review as smooth as possible by explaining not only what you changed, but why. This rationale can be very valuable down the road when improvements or bugs are discussed years later.

Reference existing issues

Link a pull request to an issue to clarify that a fix is forthcoming and which issue can be closed after merging. Only few cases (e.g., fixing typos) don’t require prior discussions.

Write tests

The library has an extensive test suite that currently covers 100 % of the library's code. These test are crucial to maintain API stability and give future contributors confidence that they do not accidentally break things. As Titus Winters aptly put it:

If you liked it, you should have put a test on it.

Run the tests

First, ensure the test suite runs before making any changes:

$ cmake -S. -B build
 $ cmake --build build -j 10
 $ ctest --test-dir build -j 10
 

The test suite should report:

100% tests passed, 0 tests failed out of 98
 

Add tests

The tests are located in tests/src/unit-*.cpp and contain doctest assertions like CHECK. The tests are structured along the features of the library or the nature of the tests. Usually, it should be clear from the context which existing file needs to be extended, and only very few cases require creating new test files.

When fixing a bug, edit unit-regression2.cpp and add a section referencing the fixed issue.

Exceptions

When you test exceptions, please use CHECK_THROWS_WITH_AS which also takes the what() argument of the thrown exception into account.

Coverage

If test coverage decreases, an automatic warning comment will be posted on the pull request. You can access a code coverage report as artifact to the “Ubuntu” workflow.

Update the documentation

The main documentation of the library is generated from the files docs/mkdocs/docs. This folder contains dedicated pages for certain features, a list of all exceptions, and an extensive API documentation with details on every public API function.

Build the documentation locally using:

make install_venv -C docs/mkdocs
 make serve -C docs/mkdocs
 

The documentation will then available at http://127.0.0.1:8000/. See the documentation of mkdocs and Material for MkDocs for more information.

Amalgamate the source code

The single-header files single_include/nlohmann/json.hpp and single_include/nlohmann/json_fwd.hpp are generated from the source files in the include/nlohmann directory. Do not edit the files directly; instead, modify the include/nlohmann sources and regenerate the files by executing:

make amalgamate
-
  • The library’s README file is an excellent starting point to understand its functionality.
  • The documentation page is the reference documentation of the library.
  • RFC 8259 is the reference for the JavaScript Object Notation (JSON) Data Interchange Format.

Please don't...

Certain contributions are not helpful.

Break the public API

We take pride in the library being used by numerous customers across various industries. They all rely on the guarantees provided by semantic versioning. Please do not change the library such that the public API of the 3.x.y version is broken. This includes:

  • Changing function signatures (altering parameter types, return types, number of parameters) or changing the const-ness of member functions.
  • Removing functions.
  • Renaming functions or classes.
  • Changing exception handling.
  • Changing exception ids.
  • Changing access specifiers.
  • Changing default arguments.

Although these guidelines may seem restrictive, they are essential for maintaining the library’s utility.

Breaking changes may be introduced when they are guarded with a feature macro such as JSON_USE_IMPLICIT_CONVERSIONS which allows to selectively change the behavior of the library. In next steps, the current behavior can then be deprecated. Using feature macros then allows users to test their code against the library in the next major release.

Break C++11 language conformance

This library is designed to work with C++11 and later. This means that any supported C++11 compiler should compile the library without problems. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support.

Please do not add features that do not work with the mentioned supported compilers. Please guard features from C++14 and later against the respective JSON_HAS_CPP_14 macros.

Break JSON conformance

Please refrain from proposing changes that would break JSON conformance. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.

Wanted

The following areas really need contribution and are always welcomed:

  • Extending the continuous integration toward more exotic compilers such as Android NDK, Intel's Compiler, or the bleeding-edge versions Clang.
  • Improving the efficiency of the JSON parser. The current parser is implemented as a naive recursive descent parser with hand coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep the parser inside the json.hpp header, and I am not aware of approaches similar to re2c for parsing.
  • Extending and updating existing benchmarks to include (the most recent version of) this library. Though efficiency is not everything, speed and memory consumption are very important characteristics for C++ developers, so having proper comparisons would be interesting.

We look forward to your contributions and collaboration to enhance the library!

\ No newline at end of file +
  • The library’s README file is an excellent starting point to understand its functionality.
  • The documentation page is the reference documentation of the library.
  • RFC 8259 is the reference for the JavaScript Object Notation (JSON) Data Interchange Format.

Please don't...

Certain contributions are not helpful.

Break the public API

We take pride in the library being used by numerous customers across various industries. They all rely on the guarantees provided by semantic versioning. Please do not change the library such that the public API of the 3.x.y version is broken. This includes:

  • Changing function signatures (altering parameter types, return types, number of parameters) or changing the const-ness of member functions.
  • Removing functions.
  • Renaming functions or classes.
  • Changing exception handling.
  • Changing exception ids.
  • Changing access specifiers.
  • Changing default arguments.

Although these guidelines may seem restrictive, they are essential for maintaining the library’s utility.

Breaking changes may be introduced when they are guarded with a feature macro such as JSON_USE_IMPLICIT_CONVERSIONS which allows to selectively change the behavior of the library. In next steps, the current behavior can then be deprecated. Using feature macros then allows users to test their code against the library in the next major release.

Break C++11 language conformance

This library is designed to work with C++11 and later. This means that any supported C++11 compiler should compile the library without problems. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support.

Please do not add features that do not work with the mentioned supported compilers. Please guard features from C++14 and later against the respective JSON_HAS_CPP_14 macros.

Break JSON conformance

Please refrain from proposing changes that would break JSON conformance. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.

Wanted

The following areas really need contribution and are always welcomed:

  • Extending the continuous integration toward more exotic compilers such as Android NDK, Intel's Compiler, or the bleeding-edge versions Clang.
  • Improving the efficiency of the JSON parser. The current parser is implemented as a naive recursive descent parser with hand coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep the parser inside the json.hpp header, and I am not aware of approaches similar to re2c for parsing.
  • Extending and updating existing benchmarks to include (the most recent version of) this library. Though efficiency is not everything, speed and memory consumption are very important characteristics for C++ developers, so having proper comparisons would be interesting.

We look forward to your contributions and collaboration to enhance the library!

\ No newline at end of file diff --git a/community/governance/index.html b/community/governance/index.html index 96690a1b3..d8803442e 100644 --- a/community/governance/index.html +++ b/community/governance/index.html @@ -1 +1 @@ - Governance - JSON for Modern C++
Skip to content

Governance

The governance model for the JSON for Modern C++ project is a Benevolent Dictator for Life (BDFL) structure. As the sole maintainer, Niels Lohmann is responsible for all key aspects of the project. The project governance may evolve as the project grows, but any changes will be documented here and communicated to contributors.

Overview

This project is led by a benevolent dictator, Niels Lohmann, and managed by the community. That is, the community actively contributes to the day-to-day maintenance of the project, but the general strategic line is drawn by the benevolent dictator. In case of disagreement, they have the last word. It is the benevolent dictator’s job to resolve disputes within the community and to ensure that the project is able to progress in a coordinated way. In turn, it is the community’s job to guide the decisions of the benevolent dictator through active engagement and contribution.

Roles and responsibilities

Benevolent dictator (project lead)

Typically, the benevolent dictator, or project lead, is self-appointed. However, because the community always has the ability to fork, this person is fully answerable to the community. The project lead’s role is a difficult one: they set the strategic objectives of the project and communicate these clearly to the community. They also have to understand the community as a whole and strive to satisfy as many conflicting needs as possible, while ensuring that the project survives in the long term.

In many ways, the role of the benevolent dictator is less about dictatorship and more about diplomacy. The key is to ensure that, as the project expands, the right people are given influence over it and the community rallies behind the vision of the project lead. The lead’s job is then to ensure that the committers (see below) make the right decisions on behalf of the project. Generally speaking, as long as the committers are aligned with the project’s strategy, the project lead will allow them to proceed as they desire.

Committers

Committers are contributors who have made several valuable contributions to the project and are now relied upon to both write code directly to the repository and screen the contributions of others. In many cases they are programmers but it is also possible that they contribute in a different role. Typically, a committer will focus on a specific aspect of the project, and will bring a level of expertise and understanding that earns them the respect of the community and the project lead. The role of committer is not an official one, it is simply a position that influential members of the community will find themselves in as the project lead looks to them for guidance and support.

Committers have no authority over the overall direction of the project. However, they do have the ear of the project lead. It is a committer’s job to ensure that the lead is aware of the community’s needs and collective objectives, and to help develop or elicit appropriate contributions to the project. Often, committers are given informal control over their specific areas of responsibility, and are assigned rights to directly modify certain areas of the source code. That is, although committers do not have explicit decision-making authority, they will often find that their actions are synonymous with the decisions made by the lead.

Contributors

Contributors are community members who either have no desire to become committers, or have not yet been given the opportunity by the benevolent dictator. They make valuable contributions, such as those outlined in the list below, but generally do not have the authority to make direct changes to the project code. Contributors engage with the project through communication tools, such as email lists, and via reports and patches attached to issues in the issue tracker, as detailed in our community tools document.

Anyone can become a contributor. There is no expectation of commitment to the project, no specific skill requirements and no selection process. To become a contributor, a community member simply has to perform one or more actions that are beneficial to the project.

Some contributors will already be engaging with the project as users, but will also find themselves doing one or more of the following:

  • supporting new users (current users often provide the most effective new user support)
  • reporting bugs
  • identifying requirements
  • supplying graphics and web design
  • programming
  • assisting with project infrastructure
  • writing documentation
  • fixing bugs
  • adding features

As contributors gain experience and familiarity with the project, they may find that the project lead starts relying on them more and more. When this begins to happen, they gradually adopt the role of committer, as described above.

Users

Users are community members who have a need for the project. They are the most important members of the community: without them, the project would have no purpose. Anyone can be a user; there are no specific requirements.

Users should be encouraged to participate in the life of the project and the community as much as possible. User contributions enable the project team to ensure that they are satisfying the needs of those users. Common user activities include (but are not limited to):

  • evangelising about the project
  • informing developers of project strengths and weaknesses from a new user’s perspective
  • providing moral support (a ‘thank you’ goes a long way)
  • providing financial support

Users who continue to engage with the project and its community will often find themselves becoming more and more involved. Such users may then go on to become contributors, as described above.

Support

All participants in the community are encouraged to provide support for new users within the project management infrastructure. This support is provided as a way of growing the community. Those seeking support should recognise that all support activity within the project is voluntary and is therefore provided as and when time allows. A user requiring guaranteed response times or results should therefore seek to purchase a support contract from a vendor. (Of course, that vendor should be an active member of the community.) However, for those willing to engage with the project on its own terms, and willing to help support other users, the community support channels are ideal.

Contribution Process

Anyone can contribute to the project, regardless of their skills, as there are many ways to contribute. For instance, a contributor might be active on the project mailing list and issue tracker, or might supply patches. The various ways of contributing are described in more detail in our roles in open source document.

The developer mailing list is the most appropriate place for a contributor to ask for help when making their first contribution.

Decision-Making Process

The benevolent dictatorship model does not need a formal conflict resolution process, since the project lead’s word is final. If the community chooses to question the wisdom of the actions of a committer, the project lead can review their decisions by checking the email archives, and either uphold or reverse them.


\ No newline at end of file + Governance - JSON for Modern C++
Skip to content

Governance

The governance model for the JSON for Modern C++ project is a Benevolent Dictator for Life (BDFL) structure. As the sole maintainer, Niels Lohmann is responsible for all key aspects of the project. The project governance may evolve as the project grows, but any changes will be documented here and communicated to contributors.

Overview

This project is led by a benevolent dictator, Niels Lohmann, and managed by the community. That is, the community actively contributes to the day-to-day maintenance of the project, but the general strategic line is drawn by the benevolent dictator. In case of disagreement, they have the last word. It is the benevolent dictator’s job to resolve disputes within the community and to ensure that the project is able to progress in a coordinated way. In turn, it is the community’s job to guide the decisions of the benevolent dictator through active engagement and contribution.

Roles and responsibilities

Benevolent dictator (project lead)

Typically, the benevolent dictator, or project lead, is self-appointed. However, because the community always has the ability to fork, this person is fully answerable to the community. The project lead’s role is a difficult one: they set the strategic objectives of the project and communicate these clearly to the community. They also have to understand the community as a whole and strive to satisfy as many conflicting needs as possible, while ensuring that the project survives in the long term.

In many ways, the role of the benevolent dictator is less about dictatorship and more about diplomacy. The key is to ensure that, as the project expands, the right people are given influence over it and the community rallies behind the vision of the project lead. The lead’s job is then to ensure that the committers (see below) make the right decisions on behalf of the project. Generally speaking, as long as the committers are aligned with the project’s strategy, the project lead will allow them to proceed as they desire.

Committers

Committers are contributors who have made several valuable contributions to the project and are now relied upon to both write code directly to the repository and screen the contributions of others. In many cases they are programmers but it is also possible that they contribute in a different role. Typically, a committer will focus on a specific aspect of the project, and will bring a level of expertise and understanding that earns them the respect of the community and the project lead. The role of committer is not an official one, it is simply a position that influential members of the community will find themselves in as the project lead looks to them for guidance and support.

Committers have no authority over the overall direction of the project. However, they do have the ear of the project lead. It is a committer’s job to ensure that the lead is aware of the community’s needs and collective objectives, and to help develop or elicit appropriate contributions to the project. Often, committers are given informal control over their specific areas of responsibility, and are assigned rights to directly modify certain areas of the source code. That is, although committers do not have explicit decision-making authority, they will often find that their actions are synonymous with the decisions made by the lead.

Contributors

Contributors are community members who either have no desire to become committers, or have not yet been given the opportunity by the benevolent dictator. They make valuable contributions, such as those outlined in the list below, but generally do not have the authority to make direct changes to the project code. Contributors engage with the project through communication tools, such as email lists, and via reports and patches attached to issues in the issue tracker, as detailed in our community tools document.

Anyone can become a contributor. There is no expectation of commitment to the project, no specific skill requirements and no selection process. To become a contributor, a community member simply has to perform one or more actions that are beneficial to the project.

Some contributors will already be engaging with the project as users, but will also find themselves doing one or more of the following:

  • supporting new users (current users often provide the most effective new user support)
  • reporting bugs
  • identifying requirements
  • supplying graphics and web design
  • programming
  • assisting with project infrastructure
  • writing documentation
  • fixing bugs
  • adding features

As contributors gain experience and familiarity with the project, they may find that the project lead starts relying on them more and more. When this begins to happen, they gradually adopt the role of committer, as described above.

Users

Users are community members who have a need for the project. They are the most important members of the community: without them, the project would have no purpose. Anyone can be a user; there are no specific requirements.

Users should be encouraged to participate in the life of the project and the community as much as possible. User contributions enable the project team to ensure that they are satisfying the needs of those users. Common user activities include (but are not limited to):

  • evangelising about the project
  • informing developers of project strengths and weaknesses from a new user’s perspective
  • providing moral support (a ‘thank you’ goes a long way)
  • providing financial support

Users who continue to engage with the project and its community will often find themselves becoming more and more involved. Such users may then go on to become contributors, as described above.

Support

All participants in the community are encouraged to provide support for new users within the project management infrastructure. This support is provided as a way of growing the community. Those seeking support should recognise that all support activity within the project is voluntary and is therefore provided as and when time allows. A user requiring guaranteed response times or results should therefore seek to purchase a support contract from a vendor. (Of course, that vendor should be an active member of the community.) However, for those willing to engage with the project on its own terms, and willing to help support other users, the community support channels are ideal.

Contribution Process

Anyone can contribute to the project, regardless of their skills, as there are many ways to contribute. For instance, a contributor might be active on the project mailing list and issue tracker, or might supply patches. The various ways of contributing are described in more detail in our roles in open source document.

The developer mailing list is the most appropriate place for a contributor to ask for help when making their first contribution.

Decision-Making Process

The benevolent dictatorship model does not need a formal conflict resolution process, since the project lead’s word is final. If the community chooses to question the wisdom of the actions of a committer, the project lead can review their decisions by checking the email archives, and either uphold or reverse them.


\ No newline at end of file diff --git a/community/index.html b/community/index.html index 3b9fcd7e8..c2fbb180c 100644 --- a/community/index.html +++ b/community/index.html @@ -1 +1 @@ - Community - JSON for Modern C++
Skip to content
\ No newline at end of file + Community - JSON for Modern C++
Skip to content
\ No newline at end of file diff --git a/community/quality_assurance/index.html b/community/quality_assurance/index.html index ff23d0141..a42403ad6 100644 --- a/community/quality_assurance/index.html +++ b/community/quality_assurance/index.html @@ -1,4 +1,4 @@ - Quality assurance - JSON for Modern C++
Skip to content

Quality assurance

Ensuring quality is paramount for this project, particularly because numerous other projects depend on it. Each commit to the library undergoes rigorous checks against the following requirements, and any violations will result in a failed build.

C++ language compliance and compiler compatibility

Requirement: Compiler support

Any compiler with complete C++11 support can compile the library without warnings.

Simple integration

Requirement: Single header

The library can be used by adding a single header to a C++ project.

  • An amalgamation script is used to check if the source code is exposed as self-contained single-header file.
  • The test suite is checked against the amalgamated source file as well as the individual source file.

Requirement: CMake as primary development tool

All library functions are exposed and usable by CMake.

  • All library options are exposed as CMake options and tested.
  • The library is tested against the earliest supported CMake version.
\ No newline at end of file diff --git a/community/security_policy/index.html b/community/security_policy/index.html index a895d5d35..aa06e1adb 100644 --- a/community/security_policy/index.html +++ b/community/security_policy/index.html @@ -1 +1 @@ - Security Policy - JSON for Modern C++
Skip to content

Security Policy

Reporting a Vulnerability

We value the security of our users and appreciate your efforts to responsibly disclose vulnerabilities. If you have identified a security vulnerability in this repository, please use the GitHub Security Advisory "Report a Vulnerability" tab.

Until it is published, this draft security advisory will only be visible to the maintainers of this project. Other users and teams may be added once the advisory is created.

We will send a response indicating the next steps in handling your report. After the initial reply to your report, we will keep you informed of the progress towards a fix and full announcement and may ask for additional information or guidance.

For vulnerabilities in third-party dependencies or modules, please report them directly to the respective maintainers.

Additional Resources

We sincerely thank you for contributing to the security and integrity of this project!

\ No newline at end of file + Security Policy - JSON for Modern C++
Skip to content

Security Policy

Reporting a Vulnerability

We value the security of our users and appreciate your efforts to responsibly disclose vulnerabilities. If you have identified a security vulnerability in this repository, please use the GitHub Security Advisory "Report a Vulnerability" tab.

Until it is published, this draft security advisory will only be visible to the maintainers of this project. Other users and teams may be added once the advisory is created.

We will send a response indicating the next steps in handling your report. After the initial reply to your report, we will keep you informed of the progress towards a fix and full announcement and may ask for additional information or guidance.

For vulnerabilities in third-party dependencies or modules, please report them directly to the respective maintainers.

Additional Resources

We sincerely thank you for contributing to the security and integrity of this project!

\ No newline at end of file diff --git a/features/arbitrary_types/index.html b/features/arbitrary_types/index.html index 6ad6ec04f..bb2213e25 100644 --- a/features/arbitrary_types/index.html +++ b/features/arbitrary_types/index.html @@ -1,4 +1,4 @@ - Arbitrary Type Conversions - JSON for Modern C++
Skip to content

Arbitrary Type Conversions

Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines:

namespace ns {
+ Arbitrary Type Conversions - JSON for Modern C++      

Arbitrary Type Conversions

Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines:

namespace ns {
     // a simple struct to model a person
     struct person {
         std::string name;
@@ -159,4 +159,4 @@
       value = j.template template get<T>(); // oops!
     }
 };
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/assertions/index.html b/features/assertions/index.html index e0597dd1e..55b0bfd5e 100644 --- a/features/assertions/index.html +++ b/features/assertions/index.html @@ -1,4 +1,4 @@ - Runtime Assertions - JSON for Modern C++
Skip to content

Runtime Assertions

The code contains numerous debug assertions to ensure class invariants are valid or to detect undefined behavior. Whereas the former class invariants are nothing to be concerned of, the latter checks for undefined behavior are to detect bugs in client code.

Switch off runtime assertions

Runtime assertions can be switched off by defining the preprocessor macro NDEBUG (see the documentation of assert) which is the default for release builds.

Change assertion behavior

The behavior of runtime assertions can be changes by defining macro JSON_ASSERT(x) before including the json.hpp header.

Function with runtime assertions

Unchecked object access to a const value

Function operator[] implements unchecked access for objects. Whereas a missing key is added in case of non-const objects, accessing a const object with a missing key is undefined behavior (think of a dereferenced null pointer) and yields a runtime assertion.

If you are not sure whether an element in an object exists, use checked access with the at function or call the contains function before.

See also the documentation on element access.

Example 1: Missing object key

The following code will trigger an assertion at runtime:

#include <nlohmann/json.hpp>
+ Runtime Assertions - JSON for Modern C++      

Runtime Assertions

The code contains numerous debug assertions to ensure class invariants are valid or to detect undefined behavior. Whereas the former class invariants are nothing to be concerned of, the latter checks for undefined behavior are to detect bugs in client code.

Switch off runtime assertions

Runtime assertions can be switched off by defining the preprocessor macro NDEBUG (see the documentation of assert) which is the default for release builds.

Change assertion behavior

The behavior of runtime assertions can be changes by defining macro JSON_ASSERT(x) before including the json.hpp header.

Function with runtime assertions

Unchecked object access to a const value

Function operator[] implements unchecked access for objects. Whereas a missing key is added in case of non-const objects, accessing a const object with a missing key is undefined behavior (think of a dereferenced null pointer) and yields a runtime assertion.

If you are not sure whether an element in an object exists, use checked access with the at function or call the contains function before.

See also the documentation on element access.

Example 1: Missing object key

The following code will trigger an assertion at runtime:

#include <nlohmann/json.hpp>
 
 using json = nlohmann::json;
 
@@ -43,4 +43,4 @@
     }
 }
 

Output:

[json.exception.parse_error.101] parse error: attempting to parse an empty input; check that your input string or stream contains the expected JSON
-

See also

\ No newline at end of file +

See also

\ No newline at end of file diff --git a/features/binary_formats/bjdata/index.html b/features/binary_formats/bjdata/index.html index cee082682..0de647776 100644 --- a/features/binary_formats/bjdata/index.html +++ b/features/binary_formats/bjdata/index.html @@ -1,4 +1,4 @@ - BJData - JSON for Modern C++
Skip to content

BJData

The BJData format was derived from and improved upon Universal Binary JSON(UBJSON) specification (Draft 12). Specifically, it introduces an optimized array container for efficient storage of N-dimensional packed arrays (ND-arrays); it also adds 5 new type markers - [u] - uint16, [m] - uint32, [M] - uint64, [h] - float16 and [B] - byte - to unambiguously map common binary numeric types; furthermore, it uses little-endian (LE) to store all numerics instead of big-endian (BE) as in UBJSON to avoid unnecessary conversions on commonly available platforms.

Compared to other binary JSON-like formats such as MessagePack and CBOR, both BJData and UBJSON demonstrate a rare combination of being both binary and quasi-human-readable. This is because all semantic elements in BJData and UBJSON, including the data-type markers and name/string types are directly human-readable. Data stored in the BJData/UBJSON format are not only compact in size, fast to read/write, but also can be directly searched or read using simple processing.

Serialization

The library uses the following mapping from JSON values types to BJData types according to the BJData specification:

JSON value type value/range BJData type marker
null null null Z
boolean true true T
boolean false false F
number_integer -9223372036854775808..-2147483649 int64 L
number_integer -2147483648..-32769 int32 l
number_integer -32768..-129 int16 I
number_integer -128..127 int8 i
number_integer 128..255 uint8 U
number_integer 256..32767 int16 I
number_integer 32768..65535 uint16 u
number_integer 65536..2147483647 int32 l
number_integer 2147483648..4294967295 uint32 m
number_integer 4294967296..9223372036854775807 int64 L
number_integer 9223372036854775808..18446744073709551615 uint64 M
number_unsigned 0..127 int8 i
number_unsigned 128..255 uint8 U
number_unsigned 256..32767 int16 I
number_unsigned 32768..65535 uint16 u
number_unsigned 65536..2147483647 int32 l
number_unsigned 2147483648..4294967295 uint32 m
number_unsigned 4294967296..9223372036854775807 int64 L
number_unsigned 9223372036854775808..18446744073709551615 uint64 M
number_float any value float64 D
string with shortest length indicator string S
array see notes on optimized format/ND-array array [
object see notes on optimized format map {
binary see notes on binary values array [$B

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a BJData value.

Any BJData output created by to_bjdata can be successfully parsed by from_bjdata.

Size constraints

The following values can not be converted to a BJData value:

  • strings with more than 18446744073709551615 bytes, i.e., 2^{64}-1 bytes (theoretical)

Unused BJData markers

The following markers are not used in the conversion:

  • Z: no-op values are not created.
  • C: single-byte strings are serialized with S markers.

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the dump() function which serializes NaN or Infinity to null.

Endianness

A breaking difference between BJData and UBJSON is the endianness of numerical values. In BJData, all numerical data types (integers UiuImlML and floating-point values hdD) are stored in the little-endian (LE) byte order as opposed to big-endian as used by UBJSON. Adopting LE to store numeric records avoids unnecessary byte swapping on most modern computers where LE is used as the default byte order.

Optimized formats

Optimized formats for containers are supported via two parameters of to_bjdata:

  • Parameter use_size adds size information to the beginning of a container and removes the closing marker.
  • Parameter use_type further checks whether all elements of a container have the same type and adds the type marker to the beginning of the container. The use_type parameter must only be used together with use_size = true.

Note that use_size = true alone may result in larger representations - the benefit of this parameter is that the receiving side is immediately informed of the number of elements in the container.

ND-array optimized format

BJData extends UBJSON's optimized array size marker to support ND-arrays of uniform numerical data types (referred to as packed arrays). For example, the 2-D uint8 integer array [[1,2],[3,4],[5,6]], stored as nested optimized array in UBJSON [ [$U#i2 1 2 [$U#i2 3 4 [$U#i2 5 6 ], can be further compressed in BJData to [$U#[$i#i2 2 3 1 2 3 4 5 6 or [$U#[i2 i3] 1 2 3 4 5 6.

To maintain type and size information, ND-arrays are converted to JSON objects following the annotated array format (defined in the JData specification (Draft 3)), when parsed using from_bjdata. For example, the above 2-D uint8 array can be parsed and accessed as

{
+ BJData - JSON for Modern C++      

BJData

The BJData format was derived from and improved upon Universal Binary JSON(UBJSON) specification (Draft 12). Specifically, it introduces an optimized array container for efficient storage of N-dimensional packed arrays (ND-arrays); it also adds 5 new type markers - [u] - uint16, [m] - uint32, [M] - uint64, [h] - float16 and [B] - byte - to unambiguously map common binary numeric types; furthermore, it uses little-endian (LE) to store all numerics instead of big-endian (BE) as in UBJSON to avoid unnecessary conversions on commonly available platforms.

Compared to other binary JSON-like formats such as MessagePack and CBOR, both BJData and UBJSON demonstrate a rare combination of being both binary and quasi-human-readable. This is because all semantic elements in BJData and UBJSON, including the data-type markers and name/string types are directly human-readable. Data stored in the BJData/UBJSON format are not only compact in size, fast to read/write, but also can be directly searched or read using simple processing.

Serialization

The library uses the following mapping from JSON values types to BJData types according to the BJData specification:

JSON value type value/range BJData type marker
null null null Z
boolean true true T
boolean false false F
number_integer -9223372036854775808..-2147483649 int64 L
number_integer -2147483648..-32769 int32 l
number_integer -32768..-129 int16 I
number_integer -128..127 int8 i
number_integer 128..255 uint8 U
number_integer 256..32767 int16 I
number_integer 32768..65535 uint16 u
number_integer 65536..2147483647 int32 l
number_integer 2147483648..4294967295 uint32 m
number_integer 4294967296..9223372036854775807 int64 L
number_integer 9223372036854775808..18446744073709551615 uint64 M
number_unsigned 0..127 int8 i
number_unsigned 128..255 uint8 U
number_unsigned 256..32767 int16 I
number_unsigned 32768..65535 uint16 u
number_unsigned 65536..2147483647 int32 l
number_unsigned 2147483648..4294967295 uint32 m
number_unsigned 4294967296..9223372036854775807 int64 L
number_unsigned 9223372036854775808..18446744073709551615 uint64 M
number_float any value float64 D
string with shortest length indicator string S
array see notes on optimized format/ND-array array [
object see notes on optimized format map {
binary see notes on binary values array [$B

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a BJData value.

Any BJData output created by to_bjdata can be successfully parsed by from_bjdata.

Size constraints

The following values can not be converted to a BJData value:

  • strings with more than 18446744073709551615 bytes, i.e., 2^{64}-1 bytes (theoretical)

Unused BJData markers

The following markers are not used in the conversion:

  • Z: no-op values are not created.
  • C: single-byte strings are serialized with S markers.

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the dump() function which serializes NaN or Infinity to null.

Endianness

A breaking difference between BJData and UBJSON is the endianness of numerical values. In BJData, all numerical data types (integers UiuImlML and floating-point values hdD) are stored in the little-endian (LE) byte order as opposed to big-endian as used by UBJSON. Adopting LE to store numeric records avoids unnecessary byte swapping on most modern computers where LE is used as the default byte order.

Optimized formats

Optimized formats for containers are supported via two parameters of to_bjdata:

  • Parameter use_size adds size information to the beginning of a container and removes the closing marker.
  • Parameter use_type further checks whether all elements of a container have the same type and adds the type marker to the beginning of the container. The use_type parameter must only be used together with use_size = true.

Note that use_size = true alone may result in larger representations - the benefit of this parameter is that the receiving side is immediately informed of the number of elements in the container.

ND-array optimized format

BJData extends UBJSON's optimized array size marker to support ND-arrays of uniform numerical data types (referred to as packed arrays). For example, the 2-D uint8 integer array [[1,2],[3,4],[5,6]], stored as nested optimized array in UBJSON [ [$U#i2 1 2 [$U#i2 3 4 [$U#i2 5 6 ], can be further compressed in BJData to [$U#[$i#i2 2 3 1 2 3 4 5 6 or [$U#[i2 i3] 1 2 3 4 5 6.

To maintain type and size information, ND-arrays are converted to JSON objects following the annotated array format (defined in the JData specification (Draft 3)), when parsed using from_bjdata. For example, the above 2-D uint8 array can be parsed and accessed as

{
     "_ArrayType_": "uint8",
     "_ArraySize_": [2,3],
     "_ArrayData_": [1,2,3,4,5,6]
@@ -95,4 +95,4 @@
   "compact": true,
   "schema": 0
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/binary_formats/bson/index.html b/features/binary_formats/bson/index.html index dc6620d41..459f5007b 100644 --- a/features/binary_formats/bson/index.html +++ b/features/binary_formats/bson/index.html @@ -1,4 +1,4 @@ - BSON - JSON for Modern C++
Skip to content

BSON

BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type.

References

Serialization

The library uses the following mapping from JSON values types to BSON types:

JSON value type value/range BSON type marker
null null null 0x0A
boolean true, false boolean 0x08
number_integer -9223372036854775808..-2147483649 int64 0x12
number_integer -2147483648..2147483647 int32 0x10
number_integer 2147483648..9223372036854775807 int64 0x12
number_unsigned 0..2147483647 int32 0x10
number_unsigned 2147483648..9223372036854775807 int64 0x12
number_unsigned 9223372036854775808..18446744073709551615 uint64 0x11
number_float any value double 0x01
string any value string 0x02
array any value document 0x04
object any value document 0x03
binary any value binary 0x05

Incomplete mapping

The mapping is incomplete, since only JSON-objects (and things contained therein) can be serialized to BSON. Also, keys may not contain U+0000, since they are serialized a zero-terminated c-strings.

Example
#include <iostream>
+ BSON - JSON for Modern C++      

BSON

BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type.

References

Serialization

The library uses the following mapping from JSON values types to BSON types:

JSON value type value/range BSON type marker
null null null 0x0A
boolean true, false boolean 0x08
number_integer -9223372036854775808..-2147483649 int64 0x12
number_integer -2147483648..2147483647 int32 0x10
number_integer 2147483648..9223372036854775807 int64 0x12
number_unsigned 0..2147483647 int32 0x10
number_unsigned 2147483648..9223372036854775807 int64 0x12
number_unsigned 9223372036854775808..18446744073709551615 uint64 0x11
number_float any value double 0x01
string any value string 0x02
array any value document 0x04
object any value document 0x03
binary any value binary 0x05

Incomplete mapping

The mapping is incomplete, since only JSON-objects (and things contained therein) can be serialized to BSON. Also, keys may not contain U+0000, since they are serialized a zero-terminated c-strings.

Example
#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
 
@@ -46,4 +46,4 @@
   "compact": true,
   "schema": 0
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/binary_formats/cbor/index.html b/features/binary_formats/cbor/index.html index 4a55caaf6..ef8aa6c50 100644 --- a/features/binary_formats/cbor/index.html +++ b/features/binary_formats/cbor/index.html @@ -1,4 +1,4 @@ - CBOR - JSON for Modern C++
Skip to content

CBOR

The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation.

References

Serialization

The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification (RFC 7049):

JSON value type value/range CBOR type first byte
null null Null 0xF6
boolean true True 0xF5
boolean false False 0xF4
number_integer -9223372036854775808..-2147483649 Negative integer (8 bytes follow) 0x3B
number_integer -2147483648..-32769 Negative integer (4 bytes follow) 0x3A
number_integer -32768..-129 Negative integer (2 bytes follow) 0x39
number_integer -128..-25 Negative integer (1 byte follow) 0x38
number_integer -24..-1 Negative integer 0x20..0x37
number_integer 0..23 Integer 0x00..0x17
number_integer 24..255 Unsigned integer (1 byte follow) 0x18
number_integer 256..65535 Unsigned integer (2 bytes follow) 0x19
number_integer 65536..4294967295 Unsigned integer (4 bytes follow) 0x1A
number_integer 4294967296..18446744073709551615 Unsigned integer (8 bytes follow) 0x1B
number_unsigned 0..23 Integer 0x00..0x17
number_unsigned 24..255 Unsigned integer (1 byte follow) 0x18
number_unsigned 256..65535 Unsigned integer (2 bytes follow) 0x19
number_unsigned 65536..4294967295 Unsigned integer (4 bytes follow) 0x1A
number_unsigned 4294967296..18446744073709551615 Unsigned integer (8 bytes follow) 0x1B
number_float any value representable by a float Single-Precision Float 0xFA
number_float any value NOT representable by a float Double-Precision Float 0xFB
string length: 0..23 UTF-8 string 0x60..0x77
string length: 23..255 UTF-8 string (1 byte follow) 0x78
string length: 256..65535 UTF-8 string (2 bytes follow) 0x79
string length: 65536..4294967295 UTF-8 string (4 bytes follow) 0x7A
string length: 4294967296..18446744073709551615 UTF-8 string (8 bytes follow) 0x7B
array size: 0..23 array 0x80..0x97
array size: 23..255 array (1 byte follow) 0x98
array size: 256..65535 array (2 bytes follow) 0x99
array size: 65536..4294967295 array (4 bytes follow) 0x9A
array size: 4294967296..18446744073709551615 array (8 bytes follow) 0x9B
object size: 0..23 map 0xA0..0xB7
object size: 23..255 map (1 byte follow) 0xB8
object size: 256..65535 map (2 bytes follow) 0xB9
object size: 65536..4294967295 map (4 bytes follow) 0xBA
object size: 4294967296..18446744073709551615 map (8 bytes follow) 0xBB
binary size: 0..23 byte string 0x40..0x57
binary size: 23..255 byte string (1 byte follow) 0x58
binary size: 256..65535 byte string (2 bytes follow) 0x59
binary size: 65536..4294967295 byte string (4 bytes follow) 0x5A
binary size: 4294967296..18446744073709551615 byte string (8 bytes follow) 0x5B

Binary values with subtype are mapped to tagged values (0xD8..0xDB) depending on the subtype, followed by a byte string, see "binary" cells in the table above.

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a CBOR value.

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the normal JSON serialization which serializes NaN or Infinity to null.

Unused CBOR types

The following CBOR types are not used in the conversion:

  • UTF-8 strings terminated by "break" (0x7F)
  • arrays terminated by "break" (0x9F)
  • maps terminated by "break" (0xBF)
  • byte strings terminated by "break" (0x5F)
  • date/time (0xC0..0xC1)
  • bignum (0xC2..0xC3)
  • decimal fraction (0xC4)
  • bigfloat (0xC5)
  • expected conversions (0xD5..0xD7)
  • simple values (0xE0..0xF3, 0xF8)
  • undefined (0xF7)
  • half-precision floats (0xF9)
  • break (0xFF)

Tagged items

Binary subtypes will be serialized as tagged items. See binary values for an example.

Example
#include <iostream>
+ CBOR - JSON for Modern C++      

CBOR

The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation.

References

Serialization

The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification (RFC 7049):

JSON value type value/range CBOR type first byte
null null Null 0xF6
boolean true True 0xF5
boolean false False 0xF4
number_integer -9223372036854775808..-2147483649 Negative integer (8 bytes follow) 0x3B
number_integer -2147483648..-32769 Negative integer (4 bytes follow) 0x3A
number_integer -32768..-129 Negative integer (2 bytes follow) 0x39
number_integer -128..-25 Negative integer (1 byte follow) 0x38
number_integer -24..-1 Negative integer 0x20..0x37
number_integer 0..23 Integer 0x00..0x17
number_integer 24..255 Unsigned integer (1 byte follow) 0x18
number_integer 256..65535 Unsigned integer (2 bytes follow) 0x19
number_integer 65536..4294967295 Unsigned integer (4 bytes follow) 0x1A
number_integer 4294967296..18446744073709551615 Unsigned integer (8 bytes follow) 0x1B
number_unsigned 0..23 Integer 0x00..0x17
number_unsigned 24..255 Unsigned integer (1 byte follow) 0x18
number_unsigned 256..65535 Unsigned integer (2 bytes follow) 0x19
number_unsigned 65536..4294967295 Unsigned integer (4 bytes follow) 0x1A
number_unsigned 4294967296..18446744073709551615 Unsigned integer (8 bytes follow) 0x1B
number_float any value representable by a float Single-Precision Float 0xFA
number_float any value NOT representable by a float Double-Precision Float 0xFB
string length: 0..23 UTF-8 string 0x60..0x77
string length: 23..255 UTF-8 string (1 byte follow) 0x78
string length: 256..65535 UTF-8 string (2 bytes follow) 0x79
string length: 65536..4294967295 UTF-8 string (4 bytes follow) 0x7A
string length: 4294967296..18446744073709551615 UTF-8 string (8 bytes follow) 0x7B
array size: 0..23 array 0x80..0x97
array size: 23..255 array (1 byte follow) 0x98
array size: 256..65535 array (2 bytes follow) 0x99
array size: 65536..4294967295 array (4 bytes follow) 0x9A
array size: 4294967296..18446744073709551615 array (8 bytes follow) 0x9B
object size: 0..23 map 0xA0..0xB7
object size: 23..255 map (1 byte follow) 0xB8
object size: 256..65535 map (2 bytes follow) 0xB9
object size: 65536..4294967295 map (4 bytes follow) 0xBA
object size: 4294967296..18446744073709551615 map (8 bytes follow) 0xBB
binary size: 0..23 byte string 0x40..0x57
binary size: 23..255 byte string (1 byte follow) 0x58
binary size: 256..65535 byte string (2 bytes follow) 0x59
binary size: 65536..4294967295 byte string (4 bytes follow) 0x5A
binary size: 4294967296..18446744073709551615 byte string (8 bytes follow) 0x5B

Binary values with subtype are mapped to tagged values (0xD8..0xDB) depending on the subtype, followed by a byte string, see "binary" cells in the table above.

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a CBOR value.

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the normal JSON serialization which serializes NaN or Infinity to null.

Unused CBOR types

The following CBOR types are not used in the conversion:

  • UTF-8 strings terminated by "break" (0x7F)
  • arrays terminated by "break" (0x9F)
  • maps terminated by "break" (0xBF)
  • byte strings terminated by "break" (0x5F)
  • date/time (0xC0..0xC1)
  • bignum (0xC2..0xC3)
  • decimal fraction (0xC4)
  • bigfloat (0xC5)
  • expected conversions (0xD5..0xD7)
  • simple values (0xE0..0xF3, 0xF8)
  • undefined (0xF7)
  • half-precision floats (0xF9)
  • break (0xFF)

Tagged items

Binary subtypes will be serialized as tagged items. See binary values for an example.

Example
#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
 
@@ -45,4 +45,4 @@
   "compact": true,
   "schema": 0
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/binary_formats/index.html b/features/binary_formats/index.html index 34d39252e..6b5b0eb51 100644 --- a/features/binary_formats/index.html +++ b/features/binary_formats/index.html @@ -1 +1 @@ - Binary Formats - JSON for Modern C++
Skip to content

Binary Formats

Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports

to efficiently encode JSON values to byte vectors and to decode such vectors.

Comparison

Completeness

Format Serialization Deserialization
BJData complete complete
BSON incomplete: top-level value must be an object incomplete, but all JSON types are supported
CBOR complete incomplete, but all JSON types are supported
MessagePack complete complete
UBJSON complete complete

Binary values

Format Binary values Binary subtypes
BJData not supported not supported
BSON supported supported
CBOR supported supported
MessagePack supported supported
UBJSON not supported not supported

See binary values for more information.

Sizes

Format canada.json twitter.json citm_catalog.json jeopardy.json
BJData 53.2 % 91.1 % 78.1 % 96.6 %
BJData (size) 58.6 % 92.1 % 86.7 % 97.4 %
BJData (size+tyoe) 58.6 % 92.1 % 86.5 % 97.4 %
BSON 85.8 % 95.2 % 95.8 % 106.7 %
CBOR 50.5 % 86.3 % 68.4 % 88.0 %
MessagePack 50.5 % 86.0 % 68.5 % 87.9 %
UBJSON 53.2 % 91.3 % 78.2 % 96.6 %
UBJSON (size) 58.6 % 92.3 % 86.8 % 97.4 %
UBJSON (size+type) 55.9 % 92.3 % 85.0 % 95.0 %

Sizes compared to minified JSON value.

\ No newline at end of file + Binary Formats - JSON for Modern C++
Skip to content

Binary Formats

Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports

to efficiently encode JSON values to byte vectors and to decode such vectors.

Comparison

Completeness

Format Serialization Deserialization
BJData complete complete
BSON incomplete: top-level value must be an object incomplete, but all JSON types are supported
CBOR complete incomplete, but all JSON types are supported
MessagePack complete complete
UBJSON complete complete

Binary values

Format Binary values Binary subtypes
BJData not supported not supported
BSON supported supported
CBOR supported supported
MessagePack supported supported
UBJSON not supported not supported

See binary values for more information.

Sizes

Format canada.json twitter.json citm_catalog.json jeopardy.json
BJData 53.2 % 91.1 % 78.1 % 96.6 %
BJData (size) 58.6 % 92.1 % 86.7 % 97.4 %
BJData (size+tyoe) 58.6 % 92.1 % 86.5 % 97.4 %
BSON 85.8 % 95.2 % 95.8 % 106.7 %
CBOR 50.5 % 86.3 % 68.4 % 88.0 %
MessagePack 50.5 % 86.0 % 68.5 % 87.9 %
UBJSON 53.2 % 91.3 % 78.2 % 96.6 %
UBJSON (size) 58.6 % 92.3 % 86.8 % 97.4 %
UBJSON (size+type) 55.9 % 92.3 % 85.0 % 95.0 %

Sizes compared to minified JSON value.

\ No newline at end of file diff --git a/features/binary_formats/messagepack/index.html b/features/binary_formats/messagepack/index.html index 1befbf14c..23d2fab41 100644 --- a/features/binary_formats/messagepack/index.html +++ b/features/binary_formats/messagepack/index.html @@ -1,4 +1,4 @@ - MessagePack - JSON for Modern C++
Skip to content

MessagePack

MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.

Serialization

The library uses the following mapping from JSON values types to MessagePack types according to the MessagePack specification:

JSON value type value/range MessagePack type first byte
null null nil 0xC0
boolean true true 0xC3
boolean false false 0xC2
number_integer -9223372036854775808..-2147483649 int64 0xD3
number_integer -2147483648..-32769 int32 0xD2
number_integer -32768..-129 int16 0xD1
number_integer -128..-33 int8 0xD0
number_integer -32..-1 negative fixint 0xE0..0xFF
number_integer 0..127 positive fixint 0x00..0x7F
number_integer 128..255 uint 8 0xCC
number_integer 256..65535 uint 16 0xCD
number_integer 65536..4294967295 uint 32 0xCE
number_integer 4294967296..18446744073709551615 uint 64 0xCF
number_unsigned 0..127 positive fixint 0x00..0x7F
number_unsigned 128..255 uint 8 0xCC
number_unsigned 256..65535 uint 16 0xCD
number_unsigned 65536..4294967295 uint 32 0xCE
number_unsigned 4294967296..18446744073709551615 uint 64 0xCF
number_float any value representable by a float float 32 0xCA
number_float any value NOT representable by a float float 64 0xCB
string length: 0..31 fixstr 0xA0..0xBF
string length: 32..255 str 8 0xD9
string length: 256..65535 str 16 0xDA
string length: 65536..4294967295 str 32 0xDB
array size: 0..15 fixarray 0x90..0x9F
array size: 16..65535 array 16 0xDC
array size: 65536..4294967295 array 32 0xDD
object size: 0..15 fix map 0x80..0x8F
object size: 16..65535 map 16 0xDE
object size: 65536..4294967295 map 32 0xDF
binary size: 0..255 bin 8 0xC4
binary size: 256..65535 bin 16 0xC5
binary size: 65536..4294967295 bin 32 0xC6

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a MessagePack value.

Any MessagePack output created by to_msgpack can be successfully parsed by from_msgpack.

Size constraints

The following values can not be converted to a MessagePack value:

  • strings with more than 4294967295 bytes
  • byte strings with more than 4294967295 bytes
  • arrays with more than 4294967295 elements
  • objects with more than 4294967295 elements

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly in contrast to the dump function which serializes NaN or Infinity to null.

Example
#include <iostream>
+ MessagePack - JSON for Modern C++      

MessagePack

MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.

Serialization

The library uses the following mapping from JSON values types to MessagePack types according to the MessagePack specification:

JSON value type value/range MessagePack type first byte
null null nil 0xC0
boolean true true 0xC3
boolean false false 0xC2
number_integer -9223372036854775808..-2147483649 int64 0xD3
number_integer -2147483648..-32769 int32 0xD2
number_integer -32768..-129 int16 0xD1
number_integer -128..-33 int8 0xD0
number_integer -32..-1 negative fixint 0xE0..0xFF
number_integer 0..127 positive fixint 0x00..0x7F
number_integer 128..255 uint 8 0xCC
number_integer 256..65535 uint 16 0xCD
number_integer 65536..4294967295 uint 32 0xCE
number_integer 4294967296..18446744073709551615 uint 64 0xCF
number_unsigned 0..127 positive fixint 0x00..0x7F
number_unsigned 128..255 uint 8 0xCC
number_unsigned 256..65535 uint 16 0xCD
number_unsigned 65536..4294967295 uint 32 0xCE
number_unsigned 4294967296..18446744073709551615 uint 64 0xCF
number_float any value representable by a float float 32 0xCA
number_float any value NOT representable by a float float 64 0xCB
string length: 0..31 fixstr 0xA0..0xBF
string length: 32..255 str 8 0xD9
string length: 256..65535 str 16 0xDA
string length: 65536..4294967295 str 32 0xDB
array size: 0..15 fixarray 0x90..0x9F
array size: 16..65535 array 16 0xDC
array size: 65536..4294967295 array 32 0xDD
object size: 0..15 fix map 0x80..0x8F
object size: 16..65535 map 16 0xDE
object size: 65536..4294967295 map 32 0xDF
binary size: 0..255 bin 8 0xC4
binary size: 256..65535 bin 16 0xC5
binary size: 65536..4294967295 bin 32 0xC6

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a MessagePack value.

Any MessagePack output created by to_msgpack can be successfully parsed by from_msgpack.

Size constraints

The following values can not be converted to a MessagePack value:

  • strings with more than 4294967295 bytes
  • byte strings with more than 4294967295 bytes
  • arrays with more than 4294967295 elements
  • objects with more than 4294967295 elements

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly in contrast to the dump function which serializes NaN or Infinity to null.

Example
#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
 
@@ -45,4 +45,4 @@
   "compact": true,
   "schema": 0
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/binary_formats/ubjson/index.html b/features/binary_formats/ubjson/index.html index 08a433d9a..ca771a2cf 100644 --- a/features/binary_formats/ubjson/index.html +++ b/features/binary_formats/ubjson/index.html @@ -1,4 +1,4 @@ - UBJSON - JSON for Modern C++
Skip to content

UBJSON

Universal Binary JSON (UBJSON) is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON.

References

Serialization

The library uses the following mapping from JSON values types to UBJSON types according to the UBJSON specification:

JSON value type value/range UBJSON type marker
null null null Z
boolean true true T
boolean false false F
number_integer -9223372036854775808..-2147483649 int64 L
number_integer -2147483648..-32769 int32 l
number_integer -32768..-129 int16 I
number_integer -128..127 int8 i
number_integer 128..255 uint8 U
number_integer 256..32767 int16 I
number_integer 32768..2147483647 int32 l
number_integer 2147483648..9223372036854775807 int64 L
number_unsigned 0..127 int8 i
number_unsigned 128..255 uint8 U
number_unsigned 256..32767 int16 I
number_unsigned 32768..2147483647 int32 l
number_unsigned 2147483648..9223372036854775807 int64 L
number_unsigned 2147483649..18446744073709551615 high-precision H
number_float any value float64 D
string with shortest length indicator string S
array see notes on optimized format array [
object see notes on optimized format map {

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a UBJSON value.

Any UBJSON output created by to_ubjson can be successfully parsed by from_ubjson.

Size constraints

The following values can not be converted to a UBJSON value:

  • strings with more than 9223372036854775807 bytes (theoretical)

Unused UBJSON markers

The following markers are not used in the conversion:

  • Z: no-op values are not created.
  • C: single-byte strings are serialized with S markers.

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the dump() function which serializes NaN or Infinity to null.

Optimized formats

The optimized formats for containers are supported: Parameter use_size adds size information to the beginning of a container and removes the closing marker. Parameter use_type further checks whether all elements of a container have the same type and adds the type marker to the beginning of the container. The use_type parameter must only be used together with use_size = true.

Note that use_size = true alone may result in larger representations - the benefit of this parameter is that the receiving side is immediately informed on the number of elements of the container.

Binary values

If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the UBJSON documentation. In particular, this means that serialization and the deserialization of a JSON containing binary values into UBJSON and back will result in a different JSON object.

Example
#include <iostream>
+ UBJSON - JSON for Modern C++      

UBJSON

Universal Binary JSON (UBJSON) is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON.

References

Serialization

The library uses the following mapping from JSON values types to UBJSON types according to the UBJSON specification:

JSON value type value/range UBJSON type marker
null null null Z
boolean true true T
boolean false false F
number_integer -9223372036854775808..-2147483649 int64 L
number_integer -2147483648..-32769 int32 l
number_integer -32768..-129 int16 I
number_integer -128..127 int8 i
number_integer 128..255 uint8 U
number_integer 256..32767 int16 I
number_integer 32768..2147483647 int32 l
number_integer 2147483648..9223372036854775807 int64 L
number_unsigned 0..127 int8 i
number_unsigned 128..255 uint8 U
number_unsigned 256..32767 int16 I
number_unsigned 32768..2147483647 int32 l
number_unsigned 2147483648..9223372036854775807 int64 L
number_unsigned 2147483649..18446744073709551615 high-precision H
number_float any value float64 D
string with shortest length indicator string S
array see notes on optimized format array [
object see notes on optimized format map {

Complete mapping

The mapping is complete in the sense that any JSON value type can be converted to a UBJSON value.

Any UBJSON output created by to_ubjson can be successfully parsed by from_ubjson.

Size constraints

The following values can not be converted to a UBJSON value:

  • strings with more than 9223372036854775807 bytes (theoretical)

Unused UBJSON markers

The following markers are not used in the conversion:

  • Z: no-op values are not created.
  • C: single-byte strings are serialized with S markers.

NaN/infinity handling

If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the dump() function which serializes NaN or Infinity to null.

Optimized formats

The optimized formats for containers are supported: Parameter use_size adds size information to the beginning of a container and removes the closing marker. Parameter use_type further checks whether all elements of a container have the same type and adds the type marker to the beginning of the container. The use_type parameter must only be used together with use_size = true.

Note that use_size = true alone may result in larger representations - the benefit of this parameter is that the receiving side is immediately informed on the number of elements of the container.

Binary values

If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the UBJSON documentation. In particular, this means that serialization and the deserialization of a JSON containing binary values into UBJSON and back will result in a different JSON object.

Example
#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
 
@@ -90,4 +90,4 @@
   "compact": true,
   "schema": 0
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/binary_values/index.html b/features/binary_values/index.html index dc2b375b7..c6da52b6e 100644 --- a/features/binary_values/index.html +++ b/features/binary_values/index.html @@ -1,4 +1,4 @@ - Binary Values - JSON for Modern C++
Skip to content

Binary Values

The library implements several binary formats that encode JSON in an efficient way. Most of these formats support binary values; that is, values that have semantics define outside the library and only define a sequence of bytes to be stored.

JSON itself does not have a binary value. As such, binary values are an extension that this library implements to store values received by a binary format. Binary values are never created by the JSON parser, and are only part of a serialized JSON text if they have been created manually or via a binary format.

API for binary values

classDiagram
+ Binary Values - JSON for Modern C++      

Binary Values

The library implements several binary formats that encode JSON in an efficient way. Most of these formats support binary values; that is, values that have semantics define outside the library and only define a sequence of bytes to be stored.

JSON itself does not have a binary value. As such, binary values are an extension that this library implements to store values received by a binary format. Binary values are never created by the JSON parser, and are only part of a serialized JSON text if they have been created manually or via a binary format.

API for binary values

classDiagram
 
 class binary_t ["json::binary_t"] {
     +void set_subtype(std::uint64_t subtype)
@@ -154,4 +154,4 @@ vector <|-- binary_t

By default, binary values are stored as

Note that subtype (42) is not serialized and that UBJSON has no binary type, and deserializing v would yield the following value:

{
   "binary": [202, 254, 186, 190]
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/comments/index.html b/features/comments/index.html index a91d665d7..04f3b8e81 100644 --- a/features/comments/index.html +++ b/features/comments/index.html @@ -1,4 +1,4 @@ - Comments - JSON for Modern C++
Skip to content

Comments

This library does not support comments by default. It does so for three reasons:

  1. Comments are not part of the JSON specification. You may argue that // or /* */ are allowed in JavaScript, but JSON is not JavaScript.
  2. This was not an oversight: Douglas Crockford wrote on this in May 2012:

    I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.

    Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.

  3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check The Harmful Consequences of the Robustness Principle on this.

However, you can pass set parameter ignore_comments to true in the parse function to ignore // or /* */ comments. Comments will then be treated as whitespace.

Example

Consider the following JSON with comments.

{
+ Comments - JSON for Modern C++      

Comments

This library does not support comments by default. It does so for three reasons:

  1. Comments are not part of the JSON specification. You may argue that // or /* */ are allowed in JavaScript, but JSON is not JavaScript.
  2. This was not an oversight: Douglas Crockford wrote on this in May 2012:

    I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.

    Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.

  3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check The Harmful Consequences of the Robustness Principle on this.

However, you can pass set parameter ignore_comments to true in the parse function to ignore // or /* */ comments. Comments will then be treated as whitespace.

Example

Consider the following JSON with comments.

{
     // update in 2006: removed Pluto
     "planets": ["Mercury", "Venus", "Earth", "Mars",
                 "Jupiter", "Uranus", "Neptune" /*, "Pluto" */]
@@ -47,4 +47,4 @@ last read: '<U+000A>    {<U+000A>        /'; expected string
     "Neptune"
   ]
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/element_access/checked_access/index.html b/features/element_access/checked_access/index.html index 24cb7910b..e785e3ec1 100644 --- a/features/element_access/checked_access/index.html +++ b/features/element_access/checked_access/index.html @@ -1,4 +1,4 @@ - Checked access: at - JSON for Modern C++
Skip to content

Checked access: at

Overview

The at member function performs checked access; that is, it returns a reference to the desired value if it exists and throws a basic_json::out_of_range exception otherwise.

Read access

Consider the following JSON value:

{
+ Checked access: at - JSON for Modern C++      

Checked access: at

Overview

The at member function performs checked access; that is, it returns a reference to the desired value if it exists and throws a basic_json::out_of_range exception otherwise.

Read access

Consider the following JSON value:

{
     "name": "Mary Smith",
     "age": 42,
     "hobbies": ["hiking", "reading"]
@@ -12,4 +12,4 @@
 

When accessing an invalid index (i.e., an index greater than or equal to the array size) or the passed object key is non-existing, an exception is thrown.

Accessing via invalid index or missing key
j.at("hobbies").at(3) = "cooking";
 

This code produces the following exception:

[json.exception.out_of_range.401] array index 3 is out of range
 

When you extended diagnostic messages are enabled by defining JSON_DIAGNOSTICS, the exception further gives information where the key or index is missing or out of range.

[json.exception.out_of_range.401] (/hobbies) array index 3 is out of range
-

Notes

Exceptions

  • at can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a basic_json::type_error is thrown.
  • basic_json::out_of_range exception exceptions are thrown if the provided key is not found in an object or the provided index is invalid.

Summary

scenario non-const value const value
access to existing object key reference to existing value is returned const reference to existing value is returned
access to valid array index reference to existing value is returned const reference to existing value is returned
access to non-existing object key basic_json::out_of_range exception is thrown basic_json::out_of_range exception is thrown
access to invalid array index basic_json::out_of_range exception is thrown basic_json::out_of_range exception is thrown
\ No newline at end of file +

Notes

Exceptions

  • at can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a basic_json::type_error is thrown.
  • basic_json::out_of_range exception exceptions are thrown if the provided key is not found in an object or the provided index is invalid.

Summary

scenario non-const value const value
access to existing object key reference to existing value is returned const reference to existing value is returned
access to valid array index reference to existing value is returned const reference to existing value is returned
access to non-existing object key basic_json::out_of_range exception is thrown basic_json::out_of_range exception is thrown
access to invalid array index basic_json::out_of_range exception is thrown basic_json::out_of_range exception is thrown
\ No newline at end of file diff --git a/features/element_access/default_value/index.html b/features/element_access/default_value/index.html index 1c5b21f74..fef9f9a69 100644 --- a/features/element_access/default_value/index.html +++ b/features/element_access/default_value/index.html @@ -1,4 +1,4 @@ - Access with default value: value - JSON for Modern C++
Skip to content

Access with default value: value

Overview

In many situations such as configuration files, missing values are not exceptional, but may be treated as if a default value was present. For this case, use value(key, default_value) which takes the key you want to access and a default value in case there is no value stored with that key.

Example

Example

Consider the following JSON value:

{
+ Access with default value: value - JSON for Modern C++      

Access with default value: value

Overview

In many situations such as configuration files, missing values are not exceptional, but may be treated as if a default value was present. For this case, use value(key, default_value) which takes the key you want to access and a default value in case there is no value stored with that key.

Example

Example

Consider the following JSON value:

{
     "logOutput": "result.log",
     "append": true
 }
@@ -20,4 +20,4 @@
 default value (int):       -1
 default value (uint64_t):  18446744073709551615
 explict return value type: 18446744073709551615
-

See also

\ No newline at end of file +

See also

\ No newline at end of file diff --git a/features/element_access/index.html b/features/element_access/index.html index 1921708f9..419bf9598 100644 --- a/features/element_access/index.html +++ b/features/element_access/index.html @@ -1 +1 @@ - Element Access - JSON for Modern C++
Skip to content

Element Access

There are many ways elements in a JSON value can be accessed:

  • unchecked access via operator[]
  • checked access via at
  • access with default value via value
  • iterators
  • JSON pointers
\ No newline at end of file + Element Access - JSON for Modern C++
Skip to content

Element Access

There are many ways elements in a JSON value can be accessed:

  • unchecked access via operator[]
  • checked access via at
  • access with default value via value
  • iterators
  • JSON pointers
\ No newline at end of file diff --git a/features/element_access/unchecked_access/index.html b/features/element_access/unchecked_access/index.html index 485d19356..6b0ad4266 100644 --- a/features/element_access/unchecked_access/index.html +++ b/features/element_access/unchecked_access/index.html @@ -1,4 +1,4 @@ - Unchecked access: operator[] - JSON for Modern C++
Skip to content

Unchecked access: operator[]

Overview

Elements in a JSON object and a JSON array can be accessed via operator[] similar to a std::map and a std::vector, respectively.

Read access

Consider the following JSON value:

{
+ Unchecked access: operator[] - JSON for Modern C++      

Unchecked access: operator[]

Overview

Elements in a JSON object and a JSON array can be accessed via operator[] similar to a std::map and a std::vector, respectively.

Read access

Consider the following JSON value:

{
     "name": "Mary Smith",
     "age": 42,
     "hobbies": ["hiking", "reading"]
@@ -19,4 +19,4 @@
     "age": 42,
     "hobbies": ["running", "reading", null, "cooking"]
 }
-

Notes

Design rationale

The library behaves differently to std::vector and std::map:

  • std::vector::operator[] never inserts a new element.
  • std::map::operator[] is not available for const values.

The type json wraps all JSON value types. It would be impossible to remove operator[] for const objects. At the same time, inserting elements for non-const objects is really convenient as it avoids awkward insert calls. To this end, we decided to have an inserting non-const behavior for both arrays and objects.

Info

The access is unchecked. In case the passed object key does not exist or the passed array index is invalid, no exception is thrown.

Danger

  • It is undefined behavior to access a const object with a non-existing key.
  • It is undefined behavior to access a const array with an invalid index.
  • In debug mode, an assertion will fire in both cases. You can disable assertions by defining the preprocessor symbol NDEBUG or redefine the macro JSON_ASSERT(x). See the documentation on runtime assertions for more information.

Exceptions

operator[] can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a basic_json::type_error is thrown.

Summary

scenario non-const value const value
access to existing object key reference to existing value is returned const reference to existing value is returned
access to valid array index reference to existing value is returned const reference to existing value is returned
access to non-existing object key reference to newly inserted null value is returned undefined behavior; runtime assertion in debug mode
access to invalid array index reference to newly inserted null value is returned; any index between previous maximal index and passed index are filled with null undefined behavior; runtime assertion in debug mode
\ No newline at end of file +

Notes

Design rationale

The library behaves differently to std::vector and std::map:

  • std::vector::operator[] never inserts a new element.
  • std::map::operator[] is not available for const values.

The type json wraps all JSON value types. It would be impossible to remove operator[] for const objects. At the same time, inserting elements for non-const objects is really convenient as it avoids awkward insert calls. To this end, we decided to have an inserting non-const behavior for both arrays and objects.

Info

The access is unchecked. In case the passed object key does not exist or the passed array index is invalid, no exception is thrown.

Danger

  • It is undefined behavior to access a const object with a non-existing key.
  • It is undefined behavior to access a const array with an invalid index.
  • In debug mode, an assertion will fire in both cases. You can disable assertions by defining the preprocessor symbol NDEBUG or redefine the macro JSON_ASSERT(x). See the documentation on runtime assertions for more information.

Exceptions

operator[] can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a basic_json::type_error is thrown.

Summary

scenario non-const value const value
access to existing object key reference to existing value is returned const reference to existing value is returned
access to valid array index reference to existing value is returned const reference to existing value is returned
access to non-existing object key reference to newly inserted null value is returned undefined behavior; runtime assertion in debug mode
access to invalid array index reference to newly inserted null value is returned; any index between previous maximal index and passed index are filled with null undefined behavior; runtime assertion in debug mode
\ No newline at end of file diff --git a/features/enum_conversion/index.html b/features/enum_conversion/index.html index cab562cf8..80c0f073d 100644 --- a/features/enum_conversion/index.html +++ b/features/enum_conversion/index.html @@ -1,4 +1,4 @@ - Specializing enum conversion - JSON for Modern C++
Skip to content

Specializing enum conversion

By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be undefined or a different enum value than was originally intended.

It is possible to more precisely specify how a given enum is mapped to and from JSON as shown below:

// example enum type declaration
+ Specializing enum conversion - JSON for Modern C++      

Specializing enum conversion

By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be undefined or a different enum value than was originally intended.

It is possible to more precisely specify how a given enum is mapped to and from JSON as shown below:

// example enum type declaration
 enum TaskState {
     TS_STOPPED,
     TS_RUNNING,
@@ -24,4 +24,4 @@
 // undefined json value to enum (where the first map entry above is the default)
 json jPi = 3.14;
 assert(jPi.template get<TaskState>() == TS_INVALID );
-

Notes

Just as in Arbitrary Type Conversions above,

  • NLOHMANN_JSON_SERIALIZE_ENUM() MUST be declared in your enum type's namespace (which can be the global namespace), or the library will not be able to locate it, and it will default to integer serialization.
  • It MUST be available (e.g., proper headers must be included) everywhere you use the conversions.

Other Important points:

  • When using template get<ENUM_TYPE>(), undefined JSON values will default to the first pair specified in your map. Select this default pair carefully.
  • If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the map will be returned when converting to or from JSON.
  • To disable the default serialization of enumerators as integers and force a compiler error instead, see JSON_DISABLE_ENUM_SERIALIZATION.
\ No newline at end of file +

Notes

Just as in Arbitrary Type Conversions above,

  • NLOHMANN_JSON_SERIALIZE_ENUM() MUST be declared in your enum type's namespace (which can be the global namespace), or the library will not be able to locate it, and it will default to integer serialization.
  • It MUST be available (e.g., proper headers must be included) everywhere you use the conversions.

Other Important points:

  • When using template get<ENUM_TYPE>(), undefined JSON values will default to the first pair specified in your map. Select this default pair carefully.
  • If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the map will be returned when converting to or from JSON.
  • To disable the default serialization of enumerators as integers and force a compiler error instead, see JSON_DISABLE_ENUM_SERIALIZATION.
\ No newline at end of file diff --git a/features/iterators/index.html b/features/iterators/index.html index 0310b25cf..de2526637 100644 --- a/features/iterators/index.html +++ b/features/iterators/index.html @@ -1,4 +1,4 @@ - Iterators - JSON for Modern C++
Skip to content

Iterators

Overview

A basic_json value is a container and allows access via iterators. Depending on the value type, basic_json stores zero or more values.

As for other containers, begin() returns an iterator to the first value and end() returns an iterator to the value following the last value. The latter iterator is a placeholder and cannot be dereferenced. In case of null values, empty arrays, or empty objects, begin() will return end().

Illustration from cppreference.com

Iteration order for objects

When iterating over objects, values are ordered with respect to the object_comparator_t type which defaults to std::less. See the types documentation for more information.

Example
// create JSON object {"one": 1, "two": 2, "three": 3}
+ Iterators - JSON for Modern C++      

Iterators

Overview

A basic_json value is a container and allows access via iterators. Depending on the value type, basic_json stores zero or more values.

As for other containers, begin() returns an iterator to the first value and end() returns an iterator to the value following the last value. The latter iterator is a placeholder and cannot be dereferenced. In case of null values, empty arrays, or empty objects, begin() will return end().

Illustration from cppreference.com

Iteration order for objects

When iterating over objects, values are ordered with respect to the object_comparator_t type which defaults to std::less. See the types documentation for more information.

Example
// create JSON object {"one": 1, "two": 2, "three": 3}
 json j;
 j["one"] = 1;
 j["two"] = 2;
@@ -53,4 +53,4 @@
     std::cout << *it << std::endl;
 }
 

Output:

"Hello, world"
-

Iterator invalidation

Operations invalidated iterators
clear all
\ No newline at end of file +

Iterator invalidation

Operations invalidated iterators
clear all
\ No newline at end of file diff --git a/features/json_patch/index.html b/features/json_patch/index.html index 40f7a3e35..b0b51bc99 100644 --- a/features/json_patch/index.html +++ b/features/json_patch/index.html @@ -1,4 +1,4 @@ - JSON Patch and Diff - JSON for Modern C++
Skip to content

JSON Patch and Diff

Patches

JSON Patch (RFC 6902) defines a JSON document structure for expressing a sequence of operations to apply to a JSON document. With the patch function, a JSON Patch is applied to the current JSON value by executing all operations from the patch.

Example

The following code shows how a JSON patch is applied to a value.

#include <iostream>
+ JSON Patch and Diff - JSON for Modern C++      

JSON Patch and Diff

Patches

JSON Patch (RFC 6902) defines a JSON document structure for expressing a sequence of operations to apply to a JSON document. With the patch function, a JSON Patch is applied to the current JSON value by executing all operations from the patch.

Example

The following code shows how a JSON patch is applied to a value.

#include <iostream>
 #include <iomanip>
 #include <nlohmann/json.hpp>
 
@@ -105,4 +105,4 @@
         "world"
     ]
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/json_pointer/index.html b/features/json_pointer/index.html index f6197918c..aadb80886 100644 --- a/features/json_pointer/index.html +++ b/features/json_pointer/index.html @@ -1,4 +1,4 @@ - JSON Pointer - JSON for Modern C++
Skip to content

JSON Pointer

Introduction

The library supports JSON Pointer (RFC 6901) as alternative means to address structured values. A JSON Pointer is a string that identifies a specific value within a JSON document.

Consider the following JSON document

{
+ JSON Pointer - JSON for Modern C++      

JSON Pointer

Introduction

The library supports JSON Pointer (RFC 6901) as alternative means to address structured values. A JSON Pointer is a string that identifies a specific value within a JSON document.

Consider the following JSON document

{
     "array": ["A", "B", "C"],
     "nested": {
         "one": 1,
@@ -45,4 +45,4 @@
   "/nested/three/1": false
 }
 

The reverse function, unflatten recreates the original value.

auto j_original = j_flat.unflatten();
-

See also

\ No newline at end of file +

See also

\ No newline at end of file diff --git a/features/macros/index.html b/features/macros/index.html index ac1cde6c0..33b858dad 100644 --- a/features/macros/index.html +++ b/features/macros/index.html @@ -1 +1 @@ - Supported Macros - JSON for Modern C++
Skip to content

Supported Macros

Some aspects of the library can be configured by defining preprocessor macros before including the json.hpp header. See also the API documentation for macros for examples and more information.

JSON_ASSERT(x)

This macro controls which code is executed for runtime assertions of the library.

See full documentation of JSON_ASSERT(x).

JSON_CATCH_USER(exception)

This macro overrides catch calls inside the library.

See full documentation of JSON_CATCH_USER(exception).

JSON_DIAGNOSTICS

This macro enables extended diagnostics for exception messages. Possible values are 1 to enable or 0 to disable (default).

When enabled, exception messages contain a JSON Pointer to the JSON value that triggered the exception, see Extended diagnostic messages for an example. Note that enabling this macro increases the size of every JSON value by one pointer and adds some runtime overhead.

The diagnostics messages can also be controlled with the CMake option JSON_Diagnostics (OFF by default) which sets JSON_DIAGNOSTICS accordingly.

See full documentation of JSON_DIAGNOSTICS.

JSON_DIAGNOSTIC_POSITIONS

When enabled, two new member functions start_pos() and end_pos() are added to basic_json values. If the value was created by calling theparse function, then these functions allow to query the byte positions of the value in the input it was parsed from. The byte positions are also used in exceptions to help locate errors.

The diagnostics positions can also be controlled with the CMake option JSON_Diagnostic_Positions (OFF by default) which sets JSON_DIAGNOSTIC_POSITIONS accordingly.

See full documentation of JSON_DIAGNOSTIC_POSITIONS

JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, JSON_HAS_CPP_20

The library targets C++11, but also supports some features introduced in later C++ versions (e.g., std::string_view support for C++17). For these new features, the library implements some preprocessor checks to determine the C++ standard. By defining any of these symbols, the internal check is overridden and the provided C++ version is unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and would be detected incorrectly.

See full documentation of JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, and JSON_HAS_CPP_20.

JSON_HAS_FILESYSTEM, JSON_HAS_EXPERIMENTAL_FILESYSTEM

When compiling with C++17, the library provides conversions from and to std::filesystem::path. As compiler support for filesystem is limited, the library tries to detect whether <filesystem>/std::filesystem (JSON_HAS_FILESYSTEM) or <experimental/filesystem>/std::experimental::filesystem (JSON_HAS_EXPERIMENTAL_FILESYSTEM) should be used. To override the built-in check, define JSON_HAS_FILESYSTEM or JSON_HAS_EXPERIMENTAL_FILESYSTEM to 1.

See full documentation of JSON_HAS_FILESYSTEM and JSON_HAS_EXPERIMENTAL_FILESYSTEM.

JSON_NOEXCEPTION

Exceptions can be switched off by defining the symbol JSON_NOEXCEPTION.

See full documentation of JSON_NOEXCEPTION.

JSON_DISABLE_ENUM_SERIALIZATION

When defined, default parse and serialize functions for enums are excluded and have to be provided by the user, for example, using NLOHMANN_JSON_SERIALIZE_ENUM.

See full documentation of JSON_DISABLE_ENUM_SERIALIZATION.

JSON_NO_IO

When defined, headers <cstdio>, <ios>, <iosfwd>, <istream>, and <ostream> are not included and parse functions relying on these headers are excluded. This is relevant for environment where these I/O functions are disallowed for security reasons (e.g., Intel Software Guard Extensions (SGX)).

See full documentation of JSON_NO_IO.

JSON_SKIP_LIBRARY_VERSION_CHECK

When defined, the library will not create a compiler warning when a different version of the library was already included.

See full documentation of JSON_SKIP_LIBRARY_VERSION_CHECK.

JSON_SKIP_UNSUPPORTED_COMPILER_CHECK

When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used.

See full documentation of JSON_SKIP_UNSUPPORTED_COMPILER_CHECK.

JSON_THROW_USER(exception)

This macro overrides throw calls inside the library. The argument is the exception to be thrown.

See full documentation of JSON_THROW_USER(exception).

JSON_TRY_USER

This macro overrides try calls inside the library.

See full documentation of JSON_TRY_USER.

JSON_USE_IMPLICIT_CONVERSIONS

When defined to 0, implicit conversions are switched off. By default, implicit conversions are switched on.

See full documentation of JSON_USE_IMPLICIT_CONVERSIONS.

NLOHMANN_DEFINE_TYPE_*(...), NLOHMANN_DEFINE_DERIVED_TYPE_*(...)

The library defines 12 macros to simplify the serialization/deserialization of types. See the page on arbitrary type conversion for a detailed discussion.

NLOHMANN_JSON_SERIALIZE_ENUM(type, ...)

This macro simplifies the serialization/deserialization of enum types. See Specializing enum conversion for more information.

See full documentation of NLOHMANN_JSON_SERIALIZE_ENUM.

NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH

These macros are defined by the library and contain the version numbers according to Semantic Versioning 2.0.0.

See full documentation of NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, and NLOHMANN_JSON_VERSION_PATCH.

\ No newline at end of file + Supported Macros - JSON for Modern C++
Skip to content

Supported Macros

Some aspects of the library can be configured by defining preprocessor macros before including the json.hpp header. See also the API documentation for macros for examples and more information.

JSON_ASSERT(x)

This macro controls which code is executed for runtime assertions of the library.

See full documentation of JSON_ASSERT(x).

JSON_CATCH_USER(exception)

This macro overrides catch calls inside the library.

See full documentation of JSON_CATCH_USER(exception).

JSON_DIAGNOSTICS

This macro enables extended diagnostics for exception messages. Possible values are 1 to enable or 0 to disable (default).

When enabled, exception messages contain a JSON Pointer to the JSON value that triggered the exception, see Extended diagnostic messages for an example. Note that enabling this macro increases the size of every JSON value by one pointer and adds some runtime overhead.

The diagnostics messages can also be controlled with the CMake option JSON_Diagnostics (OFF by default) which sets JSON_DIAGNOSTICS accordingly.

See full documentation of JSON_DIAGNOSTICS.

JSON_DIAGNOSTIC_POSITIONS

When enabled, two new member functions start_pos() and end_pos() are added to basic_json values. If the value was created by calling theparse function, then these functions allow to query the byte positions of the value in the input it was parsed from. The byte positions are also used in exceptions to help locate errors.

The diagnostics positions can also be controlled with the CMake option JSON_Diagnostic_Positions (OFF by default) which sets JSON_DIAGNOSTIC_POSITIONS accordingly.

See full documentation of JSON_DIAGNOSTIC_POSITIONS

JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, JSON_HAS_CPP_20

The library targets C++11, but also supports some features introduced in later C++ versions (e.g., std::string_view support for C++17). For these new features, the library implements some preprocessor checks to determine the C++ standard. By defining any of these symbols, the internal check is overridden and the provided C++ version is unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and would be detected incorrectly.

See full documentation of JSON_HAS_CPP_11, JSON_HAS_CPP_14, JSON_HAS_CPP_17, and JSON_HAS_CPP_20.

JSON_HAS_FILESYSTEM, JSON_HAS_EXPERIMENTAL_FILESYSTEM

When compiling with C++17, the library provides conversions from and to std::filesystem::path. As compiler support for filesystem is limited, the library tries to detect whether <filesystem>/std::filesystem (JSON_HAS_FILESYSTEM) or <experimental/filesystem>/std::experimental::filesystem (JSON_HAS_EXPERIMENTAL_FILESYSTEM) should be used. To override the built-in check, define JSON_HAS_FILESYSTEM or JSON_HAS_EXPERIMENTAL_FILESYSTEM to 1.

See full documentation of JSON_HAS_FILESYSTEM and JSON_HAS_EXPERIMENTAL_FILESYSTEM.

JSON_NOEXCEPTION

Exceptions can be switched off by defining the symbol JSON_NOEXCEPTION.

See full documentation of JSON_NOEXCEPTION.

JSON_DISABLE_ENUM_SERIALIZATION

When defined, default parse and serialize functions for enums are excluded and have to be provided by the user, for example, using NLOHMANN_JSON_SERIALIZE_ENUM.

See full documentation of JSON_DISABLE_ENUM_SERIALIZATION.

JSON_NO_IO

When defined, headers <cstdio>, <ios>, <iosfwd>, <istream>, and <ostream> are not included and parse functions relying on these headers are excluded. This is relevant for environment where these I/O functions are disallowed for security reasons (e.g., Intel Software Guard Extensions (SGX)).

See full documentation of JSON_NO_IO.

JSON_SKIP_LIBRARY_VERSION_CHECK

When defined, the library will not create a compiler warning when a different version of the library was already included.

See full documentation of JSON_SKIP_LIBRARY_VERSION_CHECK.

JSON_SKIP_UNSUPPORTED_COMPILER_CHECK

When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used.

See full documentation of JSON_SKIP_UNSUPPORTED_COMPILER_CHECK.

JSON_THROW_USER(exception)

This macro overrides throw calls inside the library. The argument is the exception to be thrown.

See full documentation of JSON_THROW_USER(exception).

JSON_TRY_USER

This macro overrides try calls inside the library.

See full documentation of JSON_TRY_USER.

JSON_USE_IMPLICIT_CONVERSIONS

When defined to 0, implicit conversions are switched off. By default, implicit conversions are switched on.

See full documentation of JSON_USE_IMPLICIT_CONVERSIONS.

NLOHMANN_DEFINE_TYPE_*(...), NLOHMANN_DEFINE_DERIVED_TYPE_*(...)

The library defines 12 macros to simplify the serialization/deserialization of types. See the page on arbitrary type conversion for a detailed discussion.

NLOHMANN_JSON_SERIALIZE_ENUM(type, ...)

This macro simplifies the serialization/deserialization of enum types. See Specializing enum conversion for more information.

See full documentation of NLOHMANN_JSON_SERIALIZE_ENUM.

NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, NLOHMANN_JSON_VERSION_PATCH

These macros are defined by the library and contain the version numbers according to Semantic Versioning 2.0.0.

See full documentation of NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, and NLOHMANN_JSON_VERSION_PATCH.

\ No newline at end of file diff --git a/features/merge_patch/index.html b/features/merge_patch/index.html index 9afd7f9f4..1f1ee6276 100644 --- a/features/merge_patch/index.html +++ b/features/merge_patch/index.html @@ -1,4 +1,4 @@ - JSON Merge Patch - JSON for Modern C++
Skip to content

JSON Merge Patch

The library supports JSON Merge Patch (RFC 7386) as a patch format. The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value.

Instead of using JSON Pointer to specify values to be manipulated, it describes the changes using a syntax that closely mimics the document being modified.

Example

The following code shows how a JSON Merge Patch is applied to a JSON document.

#include <iostream>
+ JSON Merge Patch - JSON for Modern C++      

JSON Merge Patch

The library supports JSON Merge Patch (RFC 7386) as a patch format. The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value.

Instead of using JSON Pointer to specify values to be manipulated, it describes the changes using a syntax that closely mimics the document being modified.

Example

The following code shows how a JSON Merge Patch is applied to a JSON document.

#include <iostream>
 #include <nlohmann/json.hpp>
 #include <iomanip> // for std::setw
 
@@ -50,4 +50,4 @@
     ],
     "title": "Hello!"
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/namespace/index.html b/features/namespace/index.html index 66875877a..b6b7b66df 100644 --- a/features/namespace/index.html +++ b/features/namespace/index.html @@ -1,4 +1,4 @@ - nlohmann Namespace - JSON for Modern C++
Skip to content

nlohmann Namespace

The 3.11.0 release introduced an inline namespace to allow different parts of a codebase to safely use different versions of the JSON library as long as they never exchange instances of library types.

Structure

The complete default namespace name is derived as follows:

  • The root namespace is always nlohmann.
  • The inline namespace starts with json_abi and is followed by serveral optional ABI tags according to the value of these ABI-affecting macros, in order:
  • The inline namespace ends with the suffix _v followed by the 3 components of the version number separated by underscores. To omit the version component, see Disabling the version component below.

For example, the namespace name for version 3.11.2 with JSON_DIAGNOSTICS defined to 1 is:

nlohmann::json_abi_diag_v3_11_2
+ nlohmann Namespace - JSON for Modern C++      

nlohmann Namespace

The 3.11.0 release introduced an inline namespace to allow different parts of a codebase to safely use different versions of the JSON library as long as they never exchange instances of library types.

Structure

The complete default namespace name is derived as follows:

  • The root namespace is always nlohmann.
  • The inline namespace starts with json_abi and is followed by serveral optional ABI tags according to the value of these ABI-affecting macros, in order:
  • The inline namespace ends with the suffix _v followed by the 3 components of the version number separated by underscores. To omit the version component, see Disabling the version component below.

For example, the namespace name for version 3.11.2 with JSON_DIAGNOSTICS defined to 1 is:

nlohmann::json_abi_diag_v3_11_2
 

Purpose

Several incompatibilities have been observed. Amongst the most common ones is linking code compiled with different definitions of JSON_DIAGNOSTICS. This is illustrated in the diagram below.

graph
     json["<strong>nlohmann_json (v3.10.5)</strong><br>JSON_DIAGNOSTICS=0"]
     json_diag["<strong>nlohmann_json (v3.10.5)</strong><br>JSON_DIAGNOSTICS=1"]
@@ -9,4 +9,4 @@
     app --> json_diag
     app --> library

In releases prior to 3.11.0, mixing any version of the JSON library with different JSON_DIAGNOSTICS settings would result in a crashing application. If some_library never passes instances of JSON library types to the application, this scenario became safe in version 3.11.0 and above due to the inline namespace yielding distinct symbol names.

Limitations

Neither the compiler nor the linker will issue as much as a warning when translation units – intended to be linked together and that include different versions and/or configurations of the JSON library – exchange and use library types.

There is an exception when forward declarations are used (i.e., when including json_fwd.hpp) in which case the linker may complain about undefined references.

Disabling the version component

Different versions are not necessarily ABI-incompatible, but the project does not actively track changes in the ABI and recommends that all parts of a codebase exchanging library types be built with the same version. Users can, at their own risk, disable the version component of the linline namespace, allowing different versions – but not configurations – to be used in cases where the linker would otherwise output undefined reference errors.

To do so, define NLOHMANN_JSON_NAMESPACE_NO_VERSION to 1.

This applies to version 3.11.2 and above only, versions 3.11.0 and 3.11.1 can apply the technique described in the next section to emulate the effect of the NLOHMANN_JSON_NAMESPACE_NO_VERSION macro.

Use at your own risk

Disabling the namespace version component and mixing ABI-incompatible versions will result in crashes or incorrect behavior. You have been warned!

Disabling the inline namespace completely

When interoperability with code using a pre-3.11.0 version of the library is required, users can, at their own risk restore the old namespace layout by redefining NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END as follows:

#define NLOHMANN_JSON_NAMESPACE_BEGIN  namespace nlohmann {
 #define NLOHMANN_JSON_NAMESPACE_END    }
-

Use at your own risk

Overriding the namespace and mixing ABI-incompatible versions will result in crashes or incorrect behavior. You have been warned!

Version history

  • Introduced inline namespace (json_v3_11_0[_abi-tag]*) in version 3.11.0.
  • Changed structure of inline namespace in version 3.11.2.
\ No newline at end of file +

Use at your own risk

Overriding the namespace and mixing ABI-incompatible versions will result in crashes or incorrect behavior. You have been warned!

Version history

  • Introduced inline namespace (json_v3_11_0[_abi-tag]*) in version 3.11.0.
  • Changed structure of inline namespace in version 3.11.2.
\ No newline at end of file diff --git a/features/object_order/index.html b/features/object_order/index.html index bbb830ca5..af8418600 100644 --- a/features/object_order/index.html +++ b/features/object_order/index.html @@ -1,4 +1,4 @@ - Object Order - JSON for Modern C++
Skip to content

Object Order

The JSON standard defines objects as "an unordered collection of zero or more name/value pairs". As such, an implementation does not need to preserve any specific order of object keys.

Default behavior: sort keys

The default type nlohmann::json uses a std::map to store JSON objects, and thus stores object keys sorted alphabetically.

Example
#include <iostream>
+ Object Order - JSON for Modern C++      

Object Order

The JSON standard defines objects as "an unordered collection of zero or more name/value pairs". As such, an implementation does not need to preserve any specific order of object keys.

Default behavior: sort keys

The default type nlohmann::json uses a std::map to store JSON objects, and thus stores object keys sorted alphabetically.

Example
#include <iostream>
 #include "json.hpp"
 
 using json = nlohmann::json;
@@ -57,4 +57,4 @@
   "three": 3
   "two": 2,
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/parsing/index.html b/features/parsing/index.html index b4cc67011..5cf30d123 100644 --- a/features/parsing/index.html +++ b/features/parsing/index.html @@ -1 +1 @@ - Parsing - JSON for Modern C++
Skip to content
\ No newline at end of file + Parsing - JSON for Modern C++
Skip to content
\ No newline at end of file diff --git a/features/parsing/json_lines/index.html b/features/parsing/json_lines/index.html index bfb043938..bd64cfead 100644 --- a/features/parsing/json_lines/index.html +++ b/features/parsing/json_lines/index.html @@ -1,4 +1,4 @@ - JSON Lines - JSON for Modern C++
Skip to content

JSON Lines

The JSON Lines format is a text format of newline-delimited JSON. In particular:

  1. The input must be UTF-8 encoded.
  2. Every line must be a valid JSON value.
  3. The line separator must be \n. As \r is silently ignored, \r\n is also supported.
  4. The final character may be \n, but is not required to be one.

JSON Text example

{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
+ JSON Lines - JSON for Modern C++      

JSON Lines

The JSON Lines format is a text format of newline-delimited JSON. In particular:

  1. The input must be UTF-8 encoded.
  2. Every line must be a valid JSON value.
  3. The line separator must be \n. As \r is silently ignored, \r\n is also supported.
  4. The final character may be \n, but is not required to be one.

JSON Text example

{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
 {"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
 {"name": "May", "wins": []}
 {"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
@@ -33,4 +33,4 @@
 {
     std::cout << j << std::endl;
 }
-

with a JSON Lines input does not work, because the parser will try to parse one value after the last one.

\ No newline at end of file +

with a JSON Lines input does not work, because the parser will try to parse one value after the last one.

\ No newline at end of file diff --git a/features/parsing/parse_exceptions/index.html b/features/parsing/parse_exceptions/index.html index e435a4681..c255d9101 100644 --- a/features/parsing/parse_exceptions/index.html +++ b/features/parsing/parse_exceptions/index.html @@ -1,4 +1,4 @@ - Parsing and Exceptions - JSON for Modern C++
Skip to content

Parsing and Exceptions

When the input is not valid JSON, an exception of type parse_error is thrown. This exception contains the position in the input where the error occurred, together with a diagnostic message and the last read input token. The exceptions page contains a list of examples for parse error exceptions. In case you process untrusted input, always enclose your code with a try/catch block, like

json j;
+ Parsing and Exceptions - JSON for Modern C++      

Parsing and Exceptions

When the input is not valid JSON, an exception of type parse_error is thrown. This exception contains the position in the input where the error occurred, together with a diagnostic message and the last read input token. The exceptions page contains a list of examples for parse error exceptions. In case you process untrusted input, always enclose your code with a try/catch block, like

json j;
 try
 {
     j = json::parse(my_input);
@@ -63,4 +63,4 @@
 last read: "3,]"
 parsing unsuccessful!
 parsed value: [1,2,3]
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/parsing/parser_callbacks/index.html b/features/parsing/parser_callbacks/index.html index 56d85e44b..6a1b91c94 100644 --- a/features/parsing/parser_callbacks/index.html +++ b/features/parsing/parser_callbacks/index.html @@ -1,4 +1,4 @@ - Parser Callbacks - JSON for Modern C++
Skip to content

Parser Callbacks

Overview

With a parser callback function, the result of parsing a JSON text can be influenced. When passed to parse, it is called on certain events (passed as parse_event_t via parameter event) with a set recursion depth depth and context JSON value parsed. The return value of the callback function is a boolean indicating whether the element that emitted the callback shall be kept or not.

The type of the callback function is:

template<typename BasicJsonType>
+ Parser Callbacks - JSON for Modern C++      

Parser Callbacks

Overview

With a parser callback function, the result of parsing a JSON text can be influenced. When passed to parse, it is called on certain events (passed as parse_event_t via parameter event) with a set recursion depth depth and context JSON value parsed. The return value of the callback function is a boolean indicating whether the element that emitted the callback shall be kept or not.

The type of the callback function is:

template<typename BasicJsonType>
 using parser_callback_t =
     std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;
 

Callback event types

We distinguish six scenarios (determined by the event type) in which the callback function can be called. The following table describes the values of the parameters depth, event, and parsed.

parameter event description parameter depth parameter parsed
parse_event_t::object_start the parser read { and started to process a JSON object depth of the parent of the JSON object a JSON value with type discarded
parse_event_t::key the parser read a key of a value in an object depth of the currently parsed JSON object a JSON string containing the key
parse_event_t::object_end the parser read } and finished processing a JSON object depth of the parent of the JSON object the parsed JSON object
parse_event_t::array_start the parser read [ and started to process a JSON array depth of the parent of the JSON array a JSON value with type discarded
parse_event_t::array_end the parser read ] and finished processing a JSON array depth of the parent of the JSON array the parsed JSON array
parse_event_t::value the parser finished reading a JSON value depth of the value the parsed JSON value
Example

When parsing the following JSON text,

{
@@ -90,4 +90,4 @@
         "Width": 800
     }
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/features/parsing/sax_interface/index.html b/features/parsing/sax_interface/index.html index 4dbb27792..96ba24e02 100644 --- a/features/parsing/sax_interface/index.html +++ b/features/parsing/sax_interface/index.html @@ -1,4 +1,4 @@ - SAX Interface - JSON for Modern C++
Skip to content

SAX Interface

The library uses a SAX-like interface with the following functions:

classDiagram
+ SAX Interface - JSON for Modern C++      

SAX Interface

The library uses a SAX-like interface with the following functions:

classDiagram
 
 class sax_t ["json::sax_t"] {
     <<interface>>
@@ -49,4 +49,4 @@ class sax_t ["json::sax_t"] {
 
 // called when a parse error occurs; byte position, the last token, and an exception is passed
 bool parse_error(std::size_t position, const std::string& last_token, const json::exception& ex);
-

The return value of each function determines whether parsing should proceed.

To implement your own SAX handler, proceed as follows:

  1. Implement the SAX interface in a class. You can use class nlohmann::json_sax<json> as base class, but you can also use any class where the functions described above are implemented and public.
  2. Create an object of your SAX interface class, e.g. my_sax.
  3. Call bool json::sax_parse(input, &my_sax); where the first parameter can be any input like a string or an input stream and the second parameter is a pointer to your SAX interface.

Note the sax_parse function only returns a bool indicating the result of the last executed SAX event. It does not return json value - it is up to you to decide what to do with the SAX events. Furthermore, no exceptions are thrown in case of a parse error - it is up to you what to do with the exception object passed to your parse_error implementation. Internally, the SAX interface is used for the DOM parser (class json_sax_dom_parser) as well as the acceptor (json_sax_acceptor), see file json_sax.hpp.

See also

\ No newline at end of file +

The return value of each function determines whether parsing should proceed.

To implement your own SAX handler, proceed as follows:

  1. Implement the SAX interface in a class. You can use class nlohmann::json_sax<json> as base class, but you can also use any class where the functions described above are implemented and public.
  2. Create an object of your SAX interface class, e.g. my_sax.
  3. Call bool json::sax_parse(input, &my_sax); where the first parameter can be any input like a string or an input stream and the second parameter is a pointer to your SAX interface.

Note the sax_parse function only returns a bool indicating the result of the last executed SAX event. It does not return json value - it is up to you to decide what to do with the SAX events. Furthermore, no exceptions are thrown in case of a parse error - it is up to you what to do with the exception object passed to your parse_error implementation. Internally, the SAX interface is used for the DOM parser (class json_sax_dom_parser) as well as the acceptor (json_sax_acceptor), see file json_sax.hpp.

See also

\ No newline at end of file diff --git a/features/types/index.html b/features/types/index.html index 1dd21edc5..73afff27a 100644 --- a/features/types/index.html +++ b/features/types/index.html @@ -1,4 +1,4 @@ - Types - JSON for Modern C++
Skip to content

Types

This page gives an overview how JSON values are stored and how this can be configured.

Overview

By default, JSON values are stored as follows:

JSON type C++ type
object std::map<std::string, basic_json>
array std::vector<basic_json>
null std::nullptr_t
string std::string
boolean bool
number std::int64_t, std::uint64_t, and double

Note there are three different types for numbers - when parsing JSON text, the best fitting type is chosen.

Storage

classDiagram
+ Types - JSON for Modern C++      

Types

This page gives an overview how JSON values are stored and how this can be configured.

Overview

By default, JSON values are stored as follows:

JSON type C++ type
object std::map<std::string, basic_json>
array std::vector<basic_json>
null std::nullptr_t
string std::string
boolean bool
number std::int64_t, std::uint64_t, and double

Note there are three different types for numbers - when parsing JSON text, the best fitting type is chosen.

Storage

classDiagram
 
 class value_t {
     <<enumeration>>
@@ -77,4 +77,4 @@ basic_json .. value_t

Template arguments< basic_json, // value_type std::allocator<basic_json> // allocator_type > -

Limits

RFC 8259 specifies:

An implementation may set limits on the maximum depth of nesting.

In this class, the array's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the max_size function of a JSON array.

Storage

Arrays are stored as pointers in a basic_json type. That is, for any access to array values, a pointer of type array_t* must be dereferenced.

Strings

RFC 8259 describes JSON strings as follows:

A string is a sequence of zero or more Unicode characters.

Unicode values are split by the JSON class into byte-sized characters during deserialization.

Default type

With the default values for StringType (std::string), the default value for string_t is std::string.

Encoding

Strings are stored in UTF-8 encoding. Therefore, functions like std::string::size() or std::string::length() return the number of bytes in the string rather than the number of characters or glyphs.

String comparison

RFC 8259 states:

Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that "a\\b" and "a\u005Cb" are not equal.

This implementation is interoperable as it does compare strings code unit by code unit.

Storage

String values are stored as pointers in a basic_json type. That is, for any access to string values, a pointer of type string_t* must be dereferenced.

Booleans

RFC 8259 implicitly describes a boolean as a type which differentiates the two literals true and false.

Default type

With the default values for BooleanType (bool), the default value for boolean_t is bool.

Storage

Boolean values are stored directly inside a basic_json type.

Numbers

See the number handling article for a detailed discussion on how numbers are handled by this library.

RFC 8259 describes numbers as follows:

The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.

This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, number_integer_t, number_unsigned_t, and number_float_t are used.

Default types

With the default values for NumberIntegerType (std::int64_t), the default value for number_integer_t is std::int64_t. With the default values for NumberUnsignedType (std::uint64_t), the default value for number_unsigned_t is std::uint64_t. With the default values for NumberFloatType (double), the default value for number_float_t is double.

Default behavior

  • The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal 010 will be serialized to 8. During deserialization, leading zeros yield an error.
  • Not-a-number (NaN) values will be serialized to null.

Limits

RFC 8259 specifies:

An implementation may set limits on the range and precision of numbers.

When the default type is used, the maximal integer number that can be stored is 9223372036854775807 (INT64_MAX) and the minimal integer number that can be stored is -9223372036854775808 (INT64_MIN). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as number_unsigned_t or number_float_t.

When the default type is used, the maximal unsigned integer number that can be stored is 18446744073709551615 (UINT64_MAX) and the minimal integer number that can be stored is 0. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as number_integer_t or number_float_t.

RFC 8259 further states:

Note that when such software is used, numbers that are integers and are in the range [-2^{53}+1, 2^{53}-1] are interoperable in the sense that implementations will agree exactly on their numeric values.

As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is interoperable.

RFC 8259 states:

This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754-2008 binary64 (double precision) numbers is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision.

This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than -1.79769313486232e+308 and values greater than 1.79769313486232e+308 will be stored as NaN internally and be serialized to null.

Storage

Integer number values, unsigned integer number values, and floating-point number values are stored directly inside a basic_json type.

\ No newline at end of file +

Limits

RFC 8259 specifies:

An implementation may set limits on the maximum depth of nesting.

In this class, the array's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the max_size function of a JSON array.

Storage

Arrays are stored as pointers in a basic_json type. That is, for any access to array values, a pointer of type array_t* must be dereferenced.

Strings

RFC 8259 describes JSON strings as follows:

A string is a sequence of zero or more Unicode characters.

Unicode values are split by the JSON class into byte-sized characters during deserialization.

Default type

With the default values for StringType (std::string), the default value for string_t is std::string.

Encoding

Strings are stored in UTF-8 encoding. Therefore, functions like std::string::size() or std::string::length() return the number of bytes in the string rather than the number of characters or glyphs.

String comparison

RFC 8259 states:

Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that "a\\b" and "a\u005Cb" are not equal.

This implementation is interoperable as it does compare strings code unit by code unit.

Storage

String values are stored as pointers in a basic_json type. That is, for any access to string values, a pointer of type string_t* must be dereferenced.

Booleans

RFC 8259 implicitly describes a boolean as a type which differentiates the two literals true and false.

Default type

With the default values for BooleanType (bool), the default value for boolean_t is bool.

Storage

Boolean values are stored directly inside a basic_json type.

Numbers

See the number handling article for a detailed discussion on how numbers are handled by this library.

RFC 8259 describes numbers as follows:

The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.

This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, number_integer_t, number_unsigned_t, and number_float_t are used.

Default types

With the default values for NumberIntegerType (std::int64_t), the default value for number_integer_t is std::int64_t. With the default values for NumberUnsignedType (std::uint64_t), the default value for number_unsigned_t is std::uint64_t. With the default values for NumberFloatType (double), the default value for number_float_t is double.

Default behavior

Limits

RFC 8259 specifies:

An implementation may set limits on the range and precision of numbers.

When the default type is used, the maximal integer number that can be stored is 9223372036854775807 (INT64_MAX) and the minimal integer number that can be stored is -9223372036854775808 (INT64_MIN). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as number_unsigned_t or number_float_t.

When the default type is used, the maximal unsigned integer number that can be stored is 18446744073709551615 (UINT64_MAX) and the minimal integer number that can be stored is 0. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as number_integer_t or number_float_t.

RFC 8259 further states:

Note that when such software is used, numbers that are integers and are in the range [-2^{53}+1, 2^{53}-1] are interoperable in the sense that implementations will agree exactly on their numeric values.

As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is interoperable.

RFC 8259 states:

This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754-2008 binary64 (double precision) numbers is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision.

This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than -1.79769313486232e+308 and values greater than 1.79769313486232e+308 will be stored as NaN internally and be serialized to null.

Storage

Integer number values, unsigned integer number values, and floating-point number values are stored directly inside a basic_json type.

\ No newline at end of file diff --git a/features/types/number_handling/index.html b/features/types/number_handling/index.html index d948cabf5..dd1fe483b 100644 --- a/features/types/number_handling/index.html +++ b/features/types/number_handling/index.html @@ -1,4 +1,4 @@ - Number Handling - JSON for Modern C++
Skip to content

Number Handling

This document describes how the library is handling numbers.

Background

This section briefly summarizes how the JSON specification describes how numbers should be handled.

JSON number syntax

JSON defines the syntax of numbers as follows:

RFC 8259, Section 6

The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed.

A fraction part is a decimal point followed by one or more digits.

An exponent part begins with the letter E in uppercase or lowercase, which may be followed by a plus or minus sign. The E and optional sign are followed by one or more digits.

The following railroad diagram from json.org visualizes the number syntax:

Syntax for JSON numbers

Number interoperability

On number interoperability, the following remarks are made:

RFC 8259, Section 6

This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754 binary64 (double precision) numbers [IEEE754] is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision. A JSON number such as 1E400 or 3.141592653589793238462643383279 may indicate potential interoperability problems, since it suggests that the software that created it expects receiving software to have greater capabilities for numeric magnitude and precision than is widely available.

Note that when such software is used, numbers that are integers and are in the range [-2^{53}+1, 2^{53}-1] are interoperable in the sense that implementations will agree exactly on their numeric values.

Library implementation

This section describes how the above number specification is implemented by this library.

Number storage

In the default json type, numbers are stored as std::uint64_t, std::int64_t, and double, respectively. Thereby, std::uint64_t and std::int64_t are used only if they can store the number without loss of precision. If this is impossible (e.g., if the number is too large), the number is stored as double.

Notes

Examples

  • Integer -12345678912345789123456789 is smaller than INT64_MIN and will be stored as floating-point number -1.2345678912345788e+25.
  • Integer 1E3 will be stored as floating-point number 1000.0.

Number limits

  • Any 64-bit signed or unsigned integer can be stored without loss of precision.
  • Numbers exceeding the limits of double (i.e., numbers that after conversion via std::strtod are not satisfying std::isfinite such as 1E400) will throw exception json.exception.out_of_range.406 during parsing.
  • Floating-point numbers are rounded to the next number representable as double. For instance 3.141592653589793238462643383279 is stored as 0x400921fb54442d18. This is the same behavior as the code double x = 3.141592653589793238462643383279;.

Interoperability

  • The library interoperable with respect to the specification, because its supported range [-2^{63}, 2^{64}-1] is larger than the described range [-2^{53}+1, 2^{53}-1].
  • All integers outside the range [-2^{63}, 2^{64}-1], as well as floating-point numbers are stored as double. This also concurs with the specification above.

Zeros

The JSON number grammar allows for different ways to express zero, and this library will store zeros differently:

Literal Stored value and type Serialization
0 std::uint64_t(0) 0
-0 std::int64_t(0) 0
0.0 double(0.0) 0.0
-0.0 double(-0.0) -0.0
0E0 double(0.0) 0.0
-0E0 double(-0.0) -0.0

That is, -0 is stored as a signed integer, but the serialization does not reproduce the -.

Number serialization

  • Integer numbers are serialized as is; that is, no scientific notation is used.
  • Floating-point numbers are serialized as specified by the %g printf modifier with std::numeric_limits<double>::max_digits10 significant digits. The rationale is to use the shortest representation while still allow round-tripping.

Notes regarding precision of floating-point numbers

As described above, floating-point numbers are rounded to the nearest double and serialized with the shortest representation to allow round-tripping. This can yield confusing examples:

\ No newline at end of file diff --git a/home/architecture/index.html b/home/architecture/index.html index 106e03b91..a0827c2b9 100644 --- a/home/architecture/index.html +++ b/home/architecture/index.html @@ -1,4 +1,4 @@ - Architecture - JSON for Modern C++
Skip to content

Architecture

Info

This page is still under construction. Its goal is to provide a high-level overview of the library's architecture. This should help new contributors to get an idea of the used concepts and where to make changes.

Overview

The main structure is class nlohmann::basic_json.

  • public API
  • container interface
  • iterators

Template specializations

Value storage

Values are stored as a tagged union of value_t and json_value.

/// the type of the current element
+ Architecture - JSON for Modern C++      

Architecture

Info

This page is still under construction. Its goal is to provide a high-level overview of the library's architecture. This should help new contributors to get an idea of the used concepts and where to make changes.

Overview

The main structure is class nlohmann::basic_json.

  • public API
  • container interface
  • iterators

Template specializations

Value storage

Values are stored as a tagged union of value_t and json_value.

/// the type of the current element
 value_t m_type = value_t::null;
 
 /// the value of the current element
@@ -52,4 +52,4 @@
 
 template<class T>
 void from_json(const basic_json& j, T& t);
-

Additional features

  • JSON Pointers
  • Binary formats
  • Custom base class
  • Conversion macros

Details namespace

  • C++ feature backports
\ No newline at end of file +

Additional features

  • JSON Pointers
  • Binary formats
  • Custom base class
  • Conversion macros

Details namespace

  • C++ feature backports
\ No newline at end of file diff --git a/home/customers/index.html b/home/customers/index.html index 534a00403..d25feae24 100644 --- a/home/customers/index.html +++ b/home/customers/index.html @@ -1 +1 @@ - Customers - JSON for Modern C++
Skip to content

Customers

The library is used in multiple projects, applications, operating systems, etc. The list below is not exhaustive, but the result of an internet search. If you know further customers of the library, please let me know.

Space Exploration

  • Peregrine Lunar Lander Flight 01 - The library was utilized for payload management in the Peregrine Moon Lander, developed by Astrobotic Technology and launched as part of NASA's Commercial Lunar Payload Services (CLPS) program. After six days in orbit, the spacecraft was intentionally redirected into Earth's atmosphere, where it burned up over the Pacific Ocean on January 18, 2024.

Automotive

Gaming and Entertainment

  • Assassin's Creed: Mirage: a stealth-action game set in the Middle East, focusing on the journey of a young assassin with classic parkour and stealth mechanics
  • Chasm: The Rift: a first-person shooter blending horror and adventure, where players navigate dark realms and battle monsters
  • College Football 25: a college football simulation game featuring gameplay that mimics real-life college teams and competitions
  • Concepts: a digital sketching app designed for creative professionals, offering flexible drawing tools for illustration, design, and brainstorming
  • Depthkit: a tool for creating and capturing volumetric video, enabling immersive 3D experiences and interactive content
  • immersivetech: a technology company focused on immersive experiences, providing tools and solutions for virtual and augmented reality applications
  • LOOT, a tool for optimizing the load order of game plugins, commonly used in The Elder Scrolls and Fallout series
  • Madden NFL 25: a sports simulation game capturing the excitement of American football with realistic gameplay and team management features
  • Marne, an unofficial private server platform for hosting custom Battlefield 1 game experiences
  • Minecraft, a popular sandbox video game
  • NHL 22: a hockey simulation game offering realistic gameplay, team management, and various modes to enhance the hockey experience
  • Pixelpart: a 2D animation and video compositing software that allows users to create animated graphics and visual effects with a focus on simplicity and ease of use
  • Red Dead Redemption II: an open-world action-adventure game following an outlaw's story in the late 1800s, emphasizing deep storytelling and immersive gameplay
  • Tactics Ogre: Reborn, a tactical role-playing game featuring strategic battles and deep storytelling elements
  • Throne and Liberty, an MMORPG that offers an expansive fantasy world with dynamic gameplay and immersive storytelling
  • Unity Vivox, a communication service that enables voice and text chat functionality in multiplayer games developed with Unity
  • Zool: Redimensioned: a modern reimagining of the classic platformer featuring fast-paced gameplay and vibrant environments

Consumer Electronics

  • Audinate: a provider of networked audio solutions specializing in Dante technology, which facilitates high-quality digital audio transport over IP networks
  • Cisco Webex Desk Camera, a video camera designed for professional-quality video conferencing and remote collaboration
  • Philips Hue Personal Wireless Lighting: a smart lighting system for customizable and wireless home illumination
  • Ray-Ban Meta Smart glasses, a pair of smart glasses designed for capturing photos and videos with integrated connectivity and social features
  • Siemens SINEMA Remote Connect, a remote connectivity solution for monitoring and managing industrial networks and devices securely
  • Sony PlayStation 4, a gaming console developed by Sony that offers a wide range of games and multimedia entertainment features
  • Sony Virtual Webcam Driver for Remote Camera, a software driver that enables the use of Sony cameras as virtual webcams for video conferencing and streaming

Operating Systems

  • Apple iOS and macOS, a family of operating systems developed by Apple, including iOS for mobile devices and macOS for desktop computers
  • Google Fuchsia, an open-source operating system developed by Google, designed to be secure, updatable, and adaptable across various devices
  • SerenityOS, an open-source operating system that aims to provide a simple and beautiful user experience with a focus on simplicity and elegance
  • Yocto: a Linux-based build system for creating custom operating systems and software distributions, tailored for embedded devices and IoT applications

Development Tools and IDEs

  • Accentize SpectralBalance, an adaptive speech analysis tool designed to enhance audio quality by optimizing frequency balance in recordings
  • Arm Compiler for Linux, a software development toolchain for compiling and optimizing applications on Arm-based Linux systems
  • BBEdit, a professional text and code editor for macOS
  • CoderPad, a collaborative coding platform that enables real-time code interviews and assessments for developers; the library is included in every CoderPad instance and can be accessed with a simple #include "json.hpp"
  • Compiler Explorer, a web-based tool that allows users to write, compile, and visualize the assembly output of code in various programming languages; the library is readily available and accessible with the directive #include <nlohmann/json.hpp>.
  • GitHub CodeQL, a code analysis tool used for identifying security vulnerabilities and bugs in software through semantic queries
  • Hex-Rays: a reverse engineering toolset for analyzing and decompiling binaries, primarily used for security research and vulnerability analysis
  • ImHex, a hex editor designed for reverse engineering, providing advanced features for data analysis and manipulation
  • Intel GPA Framework, a suite of cross-platform tools for capturing, analyzing, and optimizing graphics applications across different APIs
  • Meta Yoga, a layout engine that facilitates flexible and efficient user interface design across multiple platforms
  • MKVToolNix, a set of tools for creating, editing, and inspecting MKV (Matroska) multimedia container files
  • NVIDIA Nsight Compute, a performance analysis tool for CUDA applications that provides detailed insights into GPU performance metrics
  • Notepad++, a free source code editor that supports various programming languages
  • OpenRGB, an open source RGB lighting control that doesn't depend on manufacturer software
  • OpenTelemetry C++: a library for collecting and exporting observability data in C++, enabling developers to implement distributed tracing and metrics in their application
  • Qt Creator, an IDE for developing applications using the Qt application framework
  • Scanbot SDK: a software development kit (SDK) that provides tools for integrating advanced document scanning and barcode scanning capabilities into applications

Machine Learning and AI

  • Apple Core ML Tools, a set of tools for converting and configuring machine learning models for deployment in Apple's Core ML framework
  • Avular Mobile Robotics: a platform for developing and deploying mobile robotics solutions
  • Google gemma.cpp, a lightweight C++ inference engine designed for running AI models from the Gemma family
  • llama.cpp, a C++ library designed for efficient inference of large language models (LLMs), enabling streamlined integration into applications
  • MLX, an array framework for machine learning on Apple silicon
  • Mozilla llamafile, a tool designed for distributing and executing large language models (LLMs) efficiently using a single file format
  • NVIDIA ACE, a suite of real-time AI solutions designed for the development of interactive avatars and digital human applications, enabling scalable and sophisticated user interactions
  • Peer: a platform offering personalized AI assistants for interactive learning and creative collaboration
  • stable-diffusion.cpp: a C++ implementation of the Stable Diffusion image generation model
  • TanvasTouch: a software development kit (SDK) that enables developers to create tactile experiences on touchscreens, allowing users to feel textures and physical sensations in a digital environment
  • TensorFlow, a machine learning framework that facilitates the development and training of models, supporting data serialization and efficient data exchange between components

Scientific Research and Analysis

  • BLACK, a bounded linear temporal logic (LTL) satisfiability checker
  • CERN Atlas Athena, a software framework used in the ATLAS experiment at the Large Hadron Collider (LHC) for performance monitoring
  • KAMERA: a platform for synchronized data collection and real-time deep learning to map marine species like polar bears and seals, aiding Arctic ecosystem research
  • KiCad: a free and open-source software suite for electronic design automation
  • MeVisLab: a software framework for medical image processing and visualization.
  • OpenPMD API: a versatile programming interface for accessing and managing scientific data, designed to facilitate the efficient storage, retrieval, and sharing of simulation data across various applications and platforms
  • ParaView: an open-source tool for large-scale data visualization and analysis across various scientific domains
  • QGIS: a free and open-source geographic information system (GIS) application that allows users to create, edit, visualize, and analyze geospatial data across a variety of formats
  • VTK: a software library for 3D computer graphics, image processing, and visualization
  • VolView: a lightweight application for interactive visualization and analysis of 3D medical imaging data.

Business and Productivity Software

  • ArcGIS PRO, a desktop geographic information system (GIS) application developed by Esri for mapping and spatial analysis
  • Autodesk Desktop, a software platform developed by Autodesk for creating and managing desktop applications and services
  • Check Point: a cybersecurity company specializing in threat prevention and network security solutions, offering a range of products designed to protect enterprises from cyber threats and ensure data integrity
  • Microsoft Office for Mac, a suite of productivity applications developed by Microsoft for macOS, including tools for word processing, spreadsheets, and presentations
  • Nexthink Infinity: a digital employee experience management platform for monitoring and improving IT performance
  • Sophos Connect Client: a secure VPN client from Sophos that allows remote users to connect to their corporate network, ensuring secure access to resources and data
  • Stonebranch: a cloud-based cybersecurity solution that integrates backup, disaster recovery, and cybersecurity features to protect data and ensure business continuity for organizations
  • Tablecruncher: a data analysis tool that allows users to import, analyze, and visualize spreadsheet data, offering interactive features for better insights and decision-making
  • magicplan, a mobile application for creating floor plans and interior designs using augmented reality

Databases and Big Data

  • ADIOS2: a data management framework designed for high-performance input and output operations
  • Cribl Stream: a real-time data processing platform that enables organizations to collect, route, and transform observability data, enhancing visibility and insights into their systems
  • DB Browser for SQLite, a visual open-source tool for creating, designing, and editing SQLite database files
  • MySQL Connector/C++, a C++ library for connecting and interacting with MySQL databases
  • MySQL NDB Cluster, a distributed database system that provides high availability and scalability for MySQL databases
  • PrestoDB, a distributed SQL query engine designed for large-scale data analytics, originally developed by Facebook
  • ROOT Data Analysis Framework, an open-source data analysis framework widely used in high-energy physics and other fields for data processing and visualization

Simulation and Modeling

  • Arcturus HoloSuite, a software toolset for capturing, editing, and streaming volumetric video, featuring advanced compression technologies for high-quality 3D content creation
  • azul, a fast and efficient 3D city model viewer designed for visualizing urban environments and spatial data
  • Blender, a free and open-source 3D creation suite for modeling, animation, rendering, and more
  • cpplot, a library for creating interactive graphs and charts in C++, which can be viewed in web browsers
  • NVIDIA Omniverse, a platform for 3D content creation and collaboration that enables real-time simulations and interactive experiences across various industries
  • Pixar Renderman, a photorealistic 3D rendering software developed by Pixar, widely used in the film industry for creating high-quality visual effects and animations
  • ROS - Robot Operating System, a set of software libraries and tools that assist in developing robot applications
  • UBS, a multinational financial services and banking company
  • GAMS: a high-performance mathematical modeling system for optimization and decision support
  • M-Star: a computational fluid dynamics software for simulating and analyzing fluid flow
  • MapleSim CAD Toolbox: a software extension for MapleSim that integrates CAD models, allowing users to import, manipulate, and analyze 3D CAD data within the MapleSim environment for enhanced modeling and simulation
  • Kitware SMTK: a software toolkit for managing simulation models and workflows in scientific and engineering applications

Enterprise and Cloud Applications

  • Acronis Cyber Protect Cloud: an all-in-one data protection solution that combines backup, disaster recovery, and cybersecurity to safeguard business data from threats like ransomware
  • Baereos: a backup solution that provides data protection and recovery options for various environments, including physical and virtual systems
  • Bitdefender Home Scanner, a tool from Bitdefender that scans devices for malware and security threats, providing a safeguard against potential online dangers
  • Citrix Provisioning: a solution that streamlines the delivery of virtual desktops and applications by allowing administrators to manage and provision resources efficiently across multiple environments
  • Citrix Virtual Apps and Desktops, a solution from Citrix that delivers virtual apps and desktops
  • Cyberarc: a security solution that specializes in privileged access management, enabling organizations to control and monitor access to critical systems and data, thereby enhancing overall cybersecurity posture
  • Elster: a digital platform developed by German tax authorities for secure and efficient electronic tax filing and management using secunet protect4use
  • Egnyte Desktop: a secure cloud storage solution designed for businesses, enabling file sharing, collaboration, and data management across teams while ensuring compliance and data protection
  • Ethereum Solidity, a high-level, object-oriented programming language designed for implementing smart contracts on the Ethereum platform
  • Inciga: a monitoring tool for IT infrastructure, designed to provide insights into system performance and availability through customizable dashboards and alerts
  • Intel Accelerator Management Daemon for VMware ESXi: a management tool designed for monitoring and controlling Intel hardware accelerators within VMware ESXi environments, optimizing performance and resource allocation
  • Juniper Identity Management Service
  • Microsoft Azure IoT SDK, a collection of tools and libraries to help developers connect, build, and deploy Internet of Things (IoT) solutions on the Azure cloud platform
  • Microsoft WinGet, a command-line utility included in the Windows Package Manager
  • Pointr: a platform for indoor positioning and navigation solutions, offering tools and SDKs for developers to create location-based applications
  • secunet protect4use: a secure, passwordless multi-factor authentication solution that transforms smartphones into digital keyrings, ensuring high security for online services and digital identities
\ No newline at end of file + Customers - JSON for Modern C++
Skip to content

Customers

The library is used in multiple projects, applications, operating systems, etc. The list below is not exhaustive, but the result of an internet search. If you know further customers of the library, please let me know.

Space Exploration

  • Peregrine Lunar Lander Flight 01 - The library was utilized for payload management in the Peregrine Moon Lander, developed by Astrobotic Technology and launched as part of NASA's Commercial Lunar Payload Services (CLPS) program. After six days in orbit, the spacecraft was intentionally redirected into Earth's atmosphere, where it burned up over the Pacific Ocean on January 18, 2024.

Automotive

Gaming and Entertainment

  • Assassin's Creed: Mirage: a stealth-action game set in the Middle East, focusing on the journey of a young assassin with classic parkour and stealth mechanics
  • Chasm: The Rift: a first-person shooter blending horror and adventure, where players navigate dark realms and battle monsters
  • College Football 25: a college football simulation game featuring gameplay that mimics real-life college teams and competitions
  • Concepts: a digital sketching app designed for creative professionals, offering flexible drawing tools for illustration, design, and brainstorming
  • Depthkit: a tool for creating and capturing volumetric video, enabling immersive 3D experiences and interactive content
  • immersivetech: a technology company focused on immersive experiences, providing tools and solutions for virtual and augmented reality applications
  • LOOT, a tool for optimizing the load order of game plugins, commonly used in The Elder Scrolls and Fallout series
  • Madden NFL 25: a sports simulation game capturing the excitement of American football with realistic gameplay and team management features
  • Marne, an unofficial private server platform for hosting custom Battlefield 1 game experiences
  • Minecraft, a popular sandbox video game
  • NHL 22: a hockey simulation game offering realistic gameplay, team management, and various modes to enhance the hockey experience
  • Pixelpart: a 2D animation and video compositing software that allows users to create animated graphics and visual effects with a focus on simplicity and ease of use
  • Red Dead Redemption II: an open-world action-adventure game following an outlaw's story in the late 1800s, emphasizing deep storytelling and immersive gameplay
  • Tactics Ogre: Reborn, a tactical role-playing game featuring strategic battles and deep storytelling elements
  • Throne and Liberty, an MMORPG that offers an expansive fantasy world with dynamic gameplay and immersive storytelling
  • Unity Vivox, a communication service that enables voice and text chat functionality in multiplayer games developed with Unity
  • Zool: Redimensioned: a modern reimagining of the classic platformer featuring fast-paced gameplay and vibrant environments

Consumer Electronics

  • Audinate: a provider of networked audio solutions specializing in Dante technology, which facilitates high-quality digital audio transport over IP networks
  • Cisco Webex Desk Camera, a video camera designed for professional-quality video conferencing and remote collaboration
  • Philips Hue Personal Wireless Lighting: a smart lighting system for customizable and wireless home illumination
  • Ray-Ban Meta Smart glasses, a pair of smart glasses designed for capturing photos and videos with integrated connectivity and social features
  • Siemens SINEMA Remote Connect, a remote connectivity solution for monitoring and managing industrial networks and devices securely
  • Sony PlayStation 4, a gaming console developed by Sony that offers a wide range of games and multimedia entertainment features
  • Sony Virtual Webcam Driver for Remote Camera, a software driver that enables the use of Sony cameras as virtual webcams for video conferencing and streaming

Operating Systems

  • Apple iOS and macOS, a family of operating systems developed by Apple, including iOS for mobile devices and macOS for desktop computers
  • Google Fuchsia, an open-source operating system developed by Google, designed to be secure, updatable, and adaptable across various devices
  • SerenityOS, an open-source operating system that aims to provide a simple and beautiful user experience with a focus on simplicity and elegance
  • Yocto: a Linux-based build system for creating custom operating systems and software distributions, tailored for embedded devices and IoT applications

Development Tools and IDEs

  • Accentize SpectralBalance, an adaptive speech analysis tool designed to enhance audio quality by optimizing frequency balance in recordings
  • Arm Compiler for Linux, a software development toolchain for compiling and optimizing applications on Arm-based Linux systems
  • BBEdit, a professional text and code editor for macOS
  • CoderPad, a collaborative coding platform that enables real-time code interviews and assessments for developers; the library is included in every CoderPad instance and can be accessed with a simple #include "json.hpp"
  • Compiler Explorer, a web-based tool that allows users to write, compile, and visualize the assembly output of code in various programming languages; the library is readily available and accessible with the directive #include <nlohmann/json.hpp>.
  • GitHub CodeQL, a code analysis tool used for identifying security vulnerabilities and bugs in software through semantic queries
  • Hex-Rays: a reverse engineering toolset for analyzing and decompiling binaries, primarily used for security research and vulnerability analysis
  • ImHex, a hex editor designed for reverse engineering, providing advanced features for data analysis and manipulation
  • Intel GPA Framework, a suite of cross-platform tools for capturing, analyzing, and optimizing graphics applications across different APIs
  • Meta Yoga, a layout engine that facilitates flexible and efficient user interface design across multiple platforms
  • MKVToolNix, a set of tools for creating, editing, and inspecting MKV (Matroska) multimedia container files
  • NVIDIA Nsight Compute, a performance analysis tool for CUDA applications that provides detailed insights into GPU performance metrics
  • Notepad++, a free source code editor that supports various programming languages
  • OpenRGB, an open source RGB lighting control that doesn't depend on manufacturer software
  • OpenTelemetry C++: a library for collecting and exporting observability data in C++, enabling developers to implement distributed tracing and metrics in their application
  • Qt Creator, an IDE for developing applications using the Qt application framework
  • Scanbot SDK: a software development kit (SDK) that provides tools for integrating advanced document scanning and barcode scanning capabilities into applications

Machine Learning and AI

  • Apple Core ML Tools, a set of tools for converting and configuring machine learning models for deployment in Apple's Core ML framework
  • Avular Mobile Robotics: a platform for developing and deploying mobile robotics solutions
  • Google gemma.cpp, a lightweight C++ inference engine designed for running AI models from the Gemma family
  • llama.cpp, a C++ library designed for efficient inference of large language models (LLMs), enabling streamlined integration into applications
  • MLX, an array framework for machine learning on Apple silicon
  • Mozilla llamafile, a tool designed for distributing and executing large language models (LLMs) efficiently using a single file format
  • NVIDIA ACE, a suite of real-time AI solutions designed for the development of interactive avatars and digital human applications, enabling scalable and sophisticated user interactions
  • Peer: a platform offering personalized AI assistants for interactive learning and creative collaboration
  • stable-diffusion.cpp: a C++ implementation of the Stable Diffusion image generation model
  • TanvasTouch: a software development kit (SDK) that enables developers to create tactile experiences on touchscreens, allowing users to feel textures and physical sensations in a digital environment
  • TensorFlow, a machine learning framework that facilitates the development and training of models, supporting data serialization and efficient data exchange between components

Scientific Research and Analysis

  • BLACK, a bounded linear temporal logic (LTL) satisfiability checker
  • CERN Atlas Athena, a software framework used in the ATLAS experiment at the Large Hadron Collider (LHC) for performance monitoring
  • KAMERA: a platform for synchronized data collection and real-time deep learning to map marine species like polar bears and seals, aiding Arctic ecosystem research
  • KiCad: a free and open-source software suite for electronic design automation
  • MeVisLab: a software framework for medical image processing and visualization.
  • OpenPMD API: a versatile programming interface for accessing and managing scientific data, designed to facilitate the efficient storage, retrieval, and sharing of simulation data across various applications and platforms
  • ParaView: an open-source tool for large-scale data visualization and analysis across various scientific domains
  • QGIS: a free and open-source geographic information system (GIS) application that allows users to create, edit, visualize, and analyze geospatial data across a variety of formats
  • VTK: a software library for 3D computer graphics, image processing, and visualization
  • VolView: a lightweight application for interactive visualization and analysis of 3D medical imaging data.

Business and Productivity Software

  • ArcGIS PRO, a desktop geographic information system (GIS) application developed by Esri for mapping and spatial analysis
  • Autodesk Desktop, a software platform developed by Autodesk for creating and managing desktop applications and services
  • Check Point: a cybersecurity company specializing in threat prevention and network security solutions, offering a range of products designed to protect enterprises from cyber threats and ensure data integrity
  • Microsoft Office for Mac, a suite of productivity applications developed by Microsoft for macOS, including tools for word processing, spreadsheets, and presentations
  • Nexthink Infinity: a digital employee experience management platform for monitoring and improving IT performance
  • Sophos Connect Client: a secure VPN client from Sophos that allows remote users to connect to their corporate network, ensuring secure access to resources and data
  • Stonebranch: a cloud-based cybersecurity solution that integrates backup, disaster recovery, and cybersecurity features to protect data and ensure business continuity for organizations
  • Tablecruncher: a data analysis tool that allows users to import, analyze, and visualize spreadsheet data, offering interactive features for better insights and decision-making
  • magicplan, a mobile application for creating floor plans and interior designs using augmented reality

Databases and Big Data

  • ADIOS2: a data management framework designed for high-performance input and output operations
  • Cribl Stream: a real-time data processing platform that enables organizations to collect, route, and transform observability data, enhancing visibility and insights into their systems
  • DB Browser for SQLite, a visual open-source tool for creating, designing, and editing SQLite database files
  • MySQL Connector/C++, a C++ library for connecting and interacting with MySQL databases
  • MySQL NDB Cluster, a distributed database system that provides high availability and scalability for MySQL databases
  • PrestoDB, a distributed SQL query engine designed for large-scale data analytics, originally developed by Facebook
  • ROOT Data Analysis Framework, an open-source data analysis framework widely used in high-energy physics and other fields for data processing and visualization

Simulation and Modeling

  • Arcturus HoloSuite, a software toolset for capturing, editing, and streaming volumetric video, featuring advanced compression technologies for high-quality 3D content creation
  • azul, a fast and efficient 3D city model viewer designed for visualizing urban environments and spatial data
  • Blender, a free and open-source 3D creation suite for modeling, animation, rendering, and more
  • cpplot, a library for creating interactive graphs and charts in C++, which can be viewed in web browsers
  • NVIDIA Omniverse, a platform for 3D content creation and collaboration that enables real-time simulations and interactive experiences across various industries
  • Pixar Renderman, a photorealistic 3D rendering software developed by Pixar, widely used in the film industry for creating high-quality visual effects and animations
  • ROS - Robot Operating System, a set of software libraries and tools that assist in developing robot applications
  • UBS, a multinational financial services and banking company
  • GAMS: a high-performance mathematical modeling system for optimization and decision support
  • M-Star: a computational fluid dynamics software for simulating and analyzing fluid flow
  • MapleSim CAD Toolbox: a software extension for MapleSim that integrates CAD models, allowing users to import, manipulate, and analyze 3D CAD data within the MapleSim environment for enhanced modeling and simulation
  • Kitware SMTK: a software toolkit for managing simulation models and workflows in scientific and engineering applications

Enterprise and Cloud Applications

  • Acronis Cyber Protect Cloud: an all-in-one data protection solution that combines backup, disaster recovery, and cybersecurity to safeguard business data from threats like ransomware
  • Baereos: a backup solution that provides data protection and recovery options for various environments, including physical and virtual systems
  • Bitdefender Home Scanner, a tool from Bitdefender that scans devices for malware and security threats, providing a safeguard against potential online dangers
  • Citrix Provisioning: a solution that streamlines the delivery of virtual desktops and applications by allowing administrators to manage and provision resources efficiently across multiple environments
  • Citrix Virtual Apps and Desktops, a solution from Citrix that delivers virtual apps and desktops
  • Cyberarc: a security solution that specializes in privileged access management, enabling organizations to control and monitor access to critical systems and data, thereby enhancing overall cybersecurity posture
  • Elster: a digital platform developed by German tax authorities for secure and efficient electronic tax filing and management using secunet protect4use
  • Egnyte Desktop: a secure cloud storage solution designed for businesses, enabling file sharing, collaboration, and data management across teams while ensuring compliance and data protection
  • Ethereum Solidity, a high-level, object-oriented programming language designed for implementing smart contracts on the Ethereum platform
  • Inciga: a monitoring tool for IT infrastructure, designed to provide insights into system performance and availability through customizable dashboards and alerts
  • Intel Accelerator Management Daemon for VMware ESXi: a management tool designed for monitoring and controlling Intel hardware accelerators within VMware ESXi environments, optimizing performance and resource allocation
  • Juniper Identity Management Service
  • Microsoft Azure IoT SDK, a collection of tools and libraries to help developers connect, build, and deploy Internet of Things (IoT) solutions on the Azure cloud platform
  • Microsoft WinGet, a command-line utility included in the Windows Package Manager
  • Pointr: a platform for indoor positioning and navigation solutions, offering tools and SDKs for developers to create location-based applications
  • secunet protect4use: a secure, passwordless multi-factor authentication solution that transforms smartphones into digital keyrings, ensuring high security for online services and digital identities
\ No newline at end of file diff --git a/home/design_goals/index.html b/home/design_goals/index.html index 79b06c3ff..f1c62d6c5 100644 --- a/home/design_goals/index.html +++ b/home/design_goals/index.html @@ -1 +1 @@ - Design goals - JSON for Modern C++
Skip to content

Design goals

There are myriads of JSON libraries out there, and each may even have its reason to exist. Our class had these design goals:

  • Intuitive syntax. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code.

  • Trivial integration. Our whole code consists of a single header file json.hpp. That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.

  • Serious testing. Our class is heavily unit-tested and covers 100% of the code, including all exceptional behavior. Furthermore, we checked with Valgrind and the Clang Sanitizers that there are no memory leaks. Google OSS-Fuzz additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the Core Infrastructure Initiative (CII) best practices.

Other aspects were not so important to us:

  • Memory efficiency. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: std::string for strings, int64_t, uint64_t or double for numbers, std::map for objects, std::vector for arrays, and bool for Booleans. However, you can template the generalized class basic_json to your needs.

  • Speed. There are certainly faster JSON libraries out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a std::vector or std::map, you are already set.

See the contribution guidelines for more information.

\ No newline at end of file + Design goals - JSON for Modern C++
Skip to content

Design goals

There are myriads of JSON libraries out there, and each may even have its reason to exist. Our class had these design goals:

  • Intuitive syntax. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code.

  • Trivial integration. Our whole code consists of a single header file json.hpp. That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.

  • Serious testing. Our class is heavily unit-tested and covers 100% of the code, including all exceptional behavior. Furthermore, we checked with Valgrind and the Clang Sanitizers that there are no memory leaks. Google OSS-Fuzz additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the Core Infrastructure Initiative (CII) best practices.

Other aspects were not so important to us:

  • Memory efficiency. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: std::string for strings, int64_t, uint64_t or double for numbers, std::map for objects, std::vector for arrays, and bool for Booleans. However, you can template the generalized class basic_json to your needs.

  • Speed. There are certainly faster JSON libraries out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a std::vector or std::map, you are already set.

See the contribution guidelines for more information.

\ No newline at end of file diff --git a/home/exceptions/index.html b/home/exceptions/index.html index e7f01cc1b..d6120b95e 100644 --- a/home/exceptions/index.html +++ b/home/exceptions/index.html @@ -1,4 +1,4 @@ - Exceptions - JSON for Modern C++
Skip to content

Exceptions

Overview

Base type

All exceptions inherit from class json::exception (which in turn inherits from std::exception). It is used as the base class for all exceptions thrown by the basic_json class. This class can hence be used as "wildcard" to catch exceptions.

classDiagram
+ Exceptions - JSON for Modern C++      

Exceptions

Overview

Base type

All exceptions inherit from class json::exception (which in turn inherits from std::exception). It is used as the base class for all exceptions thrown by the basic_json class. This class can hence be used as "wildcard" to catch exceptions.

classDiagram
   direction LR
     class `std::exception` {
         <<interface>>
@@ -280,4 +280,4 @@ exception id: 401
 

Output:

message: [json.exception.other_error.501] unsuccessful: {"op":"test","path":"/best_biscuit/name","value":"Choco Leibniz"}
 exception id: 501
 

json.exception.other_error.501

A JSON Patch operation 'test' failed. The unsuccessful operation is also printed.

Example message

Executing {"op":"test", "path":"/baz", "value":"bar"} on {"baz": "qux"}:

[json.exception.other_error.501] unsuccessful: {"op":"test","path":"/baz","value":"bar"}
-
\ No newline at end of file +
\ No newline at end of file diff --git a/home/faq/index.html b/home/faq/index.html index 2fdcca84e..37f73de56 100644 --- a/home/faq/index.html +++ b/home/faq/index.html @@ -1,4 +1,4 @@ - FAQ - JSON for Modern C++
Skip to content

Frequently Asked Questions (FAQ)

Known bugs

Brace initialization yields arrays

Question

Why does

json j{true};
+ FAQ - JSON for Modern C++      

Frequently Asked Questions (FAQ)

Known bugs

Brace initialization yields arrays

Question

Why does

json j{true};
 

and

json j(true);
 

yield different results ([true] vs. true)?

This is a known issue, and -- even worse -- the behavior differs between GCC and Clang. The "culprit" for this is the library's constructor overloads for initializer lists to allow syntax like

json array = {1, 2, 3, 4};
 

for arrays and

json object = {{"one", 1}, {"two", 2}}; 
@@ -26,4 +26,4 @@
 

Exceptions

Parsing without exceptions

Question

Is it possible to indicate a parse error without throwing an exception?

Yes, see Parsing and exceptions.

Key name in exceptions

Question

Can I get the key of the object item that caused an exception?

Yes, you can. Please define the symbol JSON_DIAGNOSTICS to get extended diagnostics messages.

Serialization issues

Number precision

Question

  • It seems that precision is lost when serializing a double.
  • Can I change the precision for floating-point serialization?

The library uses std::numeric_limits<number_float_t>::digits10 (15 for IEEE doubles) digits for serialization. This value is sufficient to guarantee roundtripping. If one uses more than this number of digits of precision, then string -> value -> string is not guaranteed to round-trip.

cppreference.com

The value of std::numeric_limits<T>::digits10 is the number of base-10 digits that can be represented by the type T without change, that is, any number with this many significant decimal digits can be converted to a value of type T and back to decimal form, without change due to rounding or overflow.

Tip

The website https://float.exposed gives a good insight into the internal storage of floating-point numbers.

See this section on the library's number handling for more information.

Compilation issues

Android SDK

Question

Why does the code not compile with Android SDK?

Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your Application.mk. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default.

APP_STL := c++_shared
 NDK_TOOLCHAIN_VERSION := clang3.6
 APP_CPPFLAGS += -frtti -fexceptions
-

The code compiles successfully with Android NDK, Revision 9 - 11 (and possibly later) and CrystaX's Android NDK version 10.

Missing STL function

Questions

  • Why do I get a compilation error 'to_string' is not a member of 'std' (or similarly, for strtod or strtof)?
  • Why does the code not compile with MinGW or Android SDK?

This is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to this site and this discussion for information on how to fix this bug. For Android NDK using APP_STL := gnustl_static, please refer to this discussion.

\ No newline at end of file +

The code compiles successfully with Android NDK, Revision 9 - 11 (and possibly later) and CrystaX's Android NDK version 10.

Missing STL function

Questions

This is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to this site and this discussion for information on how to fix this bug. For Android NDK using APP_STL := gnustl_static, please refer to this discussion.

\ No newline at end of file diff --git a/home/license/index.html b/home/license/index.html index 3711cf591..365cc5203 100644 --- a/home/license/index.html +++ b/home/license/index.html @@ -1 +1 @@ - License - JSON for Modern C++
Skip to content

License

The class is licensed under the MIT License:

Copyright © 2013-2025 Niels Lohmann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the MIT License (see above). Copyright © 2008-2009 Björn Hoehrmann bjoern@hoehrmann.de

The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the MIT License (see above). Copyright © 2009 Florian Loitsch

The class contains a copy of Hedley from Evan Nemerson which is licensed as CC0-1.0.

\ No newline at end of file + License - JSON for Modern C++
Skip to content

License

The class is licensed under the MIT License:

Copyright © 2013-2025 Niels Lohmann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the MIT License (see above). Copyright © 2008-2009 Björn Hoehrmann bjoern@hoehrmann.de

The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the MIT License (see above). Copyright © 2009 Florian Loitsch

The class contains a copy of Hedley from Evan Nemerson which is licensed as CC0-1.0.

\ No newline at end of file diff --git a/home/releases/index.html b/home/releases/index.html index 20cf96848..b34e2d839 100644 --- a/home/releases/index.html +++ b/home/releases/index.html @@ -1,4 +1,4 @@ - Releases - JSON for Modern C++
Skip to content

Releases

v3.7.3

Files

Release date: 2019-11-17 SHA-256: 3b5d2b8f8282b80557091514d8ab97e27f9574336c804ee666fda673a9b59926 (json.hpp), 87b5884741427220d3a33df1363ae0e8b898099fbc59f1c451113f6732891014 (include.zip)

Summary

This release fixes a bug introduced in release 3.7.2 which could yield quadratic complexity in destructor calls. All changes are backward-compatible.

🐛 Bug Fixes

  • Removed reserve() calls from the destructor which could lead to quadratic complexity. #1837 #1838

🔥 Deprecated functions

This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

v3.7.2

Files

Release date: 2019-11-10 SHA-256: 0a65fcbbe1b334d3f45c9498e5ee28c3f3b2428aea98557da4a3ff12f0f14ad6 (json.hpp), 67f69c9a93b7fa0612dc1b6273119d2c560317333581845f358aaa68bff8f087 (include.zip)

Summary

Project bad_json_parsers tested how JSON parser libraries react on deeply nested inputs. It turns out that this library segfaulted at a certain nesting depth. This bug was fixed with this release. Now the parsing is only bounded by the available memory. All changes are backward-compatible.

🐛 Bug Fixes

  • Fixed a bug that lead to stack overflow for deeply nested JSON values (objects, array) by changing the implementation of the destructor from a recursive to an iterative approach. #832, #1419, #1835

🔨 Further Changes

  • Added WhiteStone Bolt. #1830

🔥 Deprecated functions

This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

v3.7.1

Files

Release date: 2019-11-06 SHA-256: b5ba7228f3c22a882d379e93d08eab4349458ee16fbf45291347994eac7dc7ce (json.hpp), 77b9f54b34e7989e6f402afb516f7ff2830df551c3a36973085e2c7a6b1045fe (include.zip)

Summary

This release fixes several small bugs in the library. All changes are backward-compatible.

🐛 Bug Fixes

  • Fixed a segmentation fault when serializing std::int64_t minimum value. #1708 #1722
  • Fixed the contains() function for JSON Pointers. #1727 #1741
  • Fixed too lax SFINAE guard for conversion from std::pair and std::tuple to json. #1805 #1806 #1825 #1826
  • Fixed some regressions detected by UBSAN. Updated CI to use Clang-Tidy 7.1.0. #1716 #1728
  • Fixed integer truncation in iteration_proxy. #1797
  • Updated Hedley to v11 to fix a E2512 error in MSVC. #1799
  • Fixed a compile error in enum deserialization of non non-default-constructible types. #1647 #1821
  • Fixed the conversion from json to std::valarray.

⚡ Improvements

  • The items() function can now be used with a custom string type. #1765
  • Made json_pointer::back const. #1764 #1769
  • Meson is part of the release archive. #1672 #1694
  • Improved documentation on the Meson and Spack package manager. #1694 #1720

🔨 Further Changes

  • Added GitHub Workflow with ubuntu-latest/GCC 7.4.0 as CI step.
  • Added GCC 9 to Travis CI to compile with C++20 support. #1724
  • Added MSVC 2019 to the AppVeyor CI. #1780
  • Added badge to fuzzing status.
  • Fixed some cppcheck warnings. #1760
  • Fixed several typos in the documentation. #1720 #1767 #1803
  • Added documentation on the JSON_THROW_USER, JSON_TRY_USER, and JSON_CATCH_USER macros to control user-defined exception handling.
  • Used GitHub's CODEOWNERS and SECURITY feature.
  • Removed GLOB from CMake files. #1779
  • Updated to Doctest 2.3.5.

🔥 Deprecated functions

This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

v3.7.0

Files

Release date: 2019-07-28 SHA-256: a503214947952b69f0062f572cb74c17582a495767446347ce2e452963fc2ca4 (json.hpp), 541c34438fd54182e9cdc68dd20c898d766713ad6d901fb2c6e28ff1f1e7c10d (include.zip)

Summary

This release introduces a few convenience functions and performs a lot of house keeping (bug fixes and small improvements). All changes are backward-compatible.

✨ New Features

  • Add overload of the contains function to check if a JSON pointer is valid without throwing exceptions, just like its counterpart for object keys. #1600
  • Add a function to_string to allow for generic conversion to strings. #916 #1585
  • Add return value for the emplace_back function, returning a reference to the added element just like C++17 is introducing this for std::vector. #1609
  • Add info how to use the library with the pacman package manager on MSYS2. #1670

🐛 Bug Fixes

  • Fix an issue where typedefs with certain names yielded a compilation error. #1642 #1643
  • Fix a conversion to std::string_view in the unit tests. #1634 #1639
  • Fix MSVC Debug build. #1536 #1570 #1608
  • Fix get_to method to clear existing content before writing. #1511 #1555
  • Fix a -Wc++17-extensions warning. nodiscard attributes are now only used with Clang when -std=c++17 is used. #1535 #1551

⚡ Improvements

🔨 Further Changes

  • Use GNUInstallDirs to set library install directories. #1673
  • Fix links in the README. #1620 #1621 #1622 #1623 #1625
  • Mention json type on the documentation start page. #1616
  • Complete documentation of value() function with respect to type_error.302 exception. #1601
  • Fix links in the documentation. #1598
  • Add regression tests for MSVC. #1543 #1570
  • Use CircleCI for continuous integration.
  • Use Doozer for continuous integration on Linux (CentOS, Raspbian, Fedora)
  • Add tests to check each CMake flag (JSON_BuildTests, JSON_Install, JSON_MultipleHeaders, JSON_Sanitizer, JSON_Valgrind, JSON_NoExceptions, JSON_Coverage).
  • Use Hedley to avoid re-inventing several compiler-agnostic feature macros like JSON_DEPRECATED, JSON_NODISCARD, JSON_LIKELY, JSON_UNLIKELY, JSON_HAS_CPP_14, or JSON_HAS_CPP_17. Functions taking or returning pointers are annotated accordingly when a pointer will not be null.
  • Build and run tests on AppVeyor in DEBUG and RELEASE mode.

🔥 Deprecated functions

This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

v3.6.1

Files

Release date: 2019-03-20 SHA-256: d2eeb25d2e95bffeb08ebb7704cdffd2e8fca7113eba9a0b38d60a5c391ea09a (json.hpp), 69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf (include.zip)

Summary

This release fixes a regression and a bug introduced by the earlier 3.6.0 release. All changes are backward-compatible.

🐛 Bug Fixes

  • Fixed regression of #590 which could lead to compilation errors with GCC 7 and GCC 8. #1530
  • Fixed a compilation error when <Windows.h> was included. #1531

🔨 Further Changes

  • Fixed a warning for missing field initializers. #1527

🔥 Deprecated functions

This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

v3.6.0

Files

Release date: 2019-03-20 SHA-256: ce9839370f28094c71107c405affb3b08c4a098154988014cbb0800b1c44a831 (json.hpp), 237c5e66e7f8186a02804ce9dbd5f69ce89fe7424ef84adf6142e973bd9532f4 (include.zip)

ℹ️ This release introduced a regression. Please update to version 3.6.1!

Summary

This release adds some convenience functions for JSON Pointers, introduces a contains function to check if a key is present in an object, and improves the performance of integer serialization. Furthermore, a lot of small bug fixes and improvements have been made. All changes are backward-compatible.

✨ New Features

  • Overworked the public interface for JSON Pointers. The creation of JSON Pointers is simplified with operator/ and operator/=. JSON Pointers can be inspected with empty, back, and parent_pointer, and manipulated with push_back and pop_back. #1434
  • Added a boolean method contains to check whether an element exists in a JSON object with a given key. Returns false when called on non-object types. #1471 #1474

🐛 Bug Fixes

  • Fixed a compilation issues with libc 2.12. #1483 #1514
  • Fixed endian conversion on PPC64. #1489
  • Fixed library to compile with GCC 9. #1472 #1492
  • Fixed a compilation issue with GCC 7 on CentOS. #1496
  • Fixed an integer overflow. #1447
  • Fixed buffer flushing in serializer. #1445 #1446

⚡ Improvements

  • The performance of dumping integers has been greatly improved. #1411
  • Added CMake parameter JSON_Install to control whether the library should be installed (default: on). #1330
  • Fixed a lot of compiler and linter warnings. #1400 #1435 #1502
  • Reduced required CMake version from 3.8 to 3.1. #1409 #1428 #1441 #1498
  • Added nodiscard attribute to meta(), array(), object(), from_cbor, from_msgpack, from_ubjson, from_bson, and parse. #1433

🔨 Further Changes

  • Added missing headers. #1500
  • Fixed typos and broken links in README. #1417 #1423 #1425 #1451 #1455 #1491
  • Fixed documentation of parse function. #1473
  • Suppressed warning that cannot be fixed inside the library. #1401 #1468
  • Imroved package manager suppert:
    • Updated Buckaroo instructions. #1495
    • Improved Meson support. #1463
    • Added Conda package manager documentation. #1430
    • Added NuGet package manager documentation. #1132
  • Continuous Integration
    • Removed unstable or deprecated Travis builders (Xcode 6.4 - 8.2) and added Xcode 10.1 builder.
    • Added Clang 7 to Travis CI.
    • Fixed AppVeyor x64 builds. #1374 #1414
  • Updated thirdparty libraries:
    • Catch 1.12.0 -> 1.12.2
    • Google Benchmark 1.3.0 -> 1.4.1
    • Doxygen 1.8.15 -> 1.8.16

🔥 Deprecated functions

This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

v3.5.0

Files

Release date: 2018-12-22 SHA-256: 8a6dbf3bf01156f438d0ca7e78c2971bca50eec4ca6f0cf59adf3464c43bb9d5 (json.hpp), 3564da9c5b0cf2e032f97c69baedf10ddbc98030c337d0327a215ea72259ea21 (include.zip)

Summary

This release introduces the support for structured bindings and reading from FILE*. Besides, a few bugs have been fixed. All changes are backward-compatible.

✨ New Features

  • Structured bindings are now supported for JSON objects and arrays via the items() member function, so finally this code is possible:

    for (auto& [key, val] : j.items()) {
    + Releases - JSON for Modern C++      

    Releases

    v3.7.3

    Files

    Release date: 2019-11-17 SHA-256: 3b5d2b8f8282b80557091514d8ab97e27f9574336c804ee666fda673a9b59926 (json.hpp), 87b5884741427220d3a33df1363ae0e8b898099fbc59f1c451113f6732891014 (include.zip)

    Summary

    This release fixes a bug introduced in release 3.7.2 which could yield quadratic complexity in destructor calls. All changes are backward-compatible.

    🐛 Bug Fixes

    • Removed reserve() calls from the destructor which could lead to quadratic complexity. #1837 #1838

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.7.2

    Files

    Release date: 2019-11-10 SHA-256: 0a65fcbbe1b334d3f45c9498e5ee28c3f3b2428aea98557da4a3ff12f0f14ad6 (json.hpp), 67f69c9a93b7fa0612dc1b6273119d2c560317333581845f358aaa68bff8f087 (include.zip)

    Summary

    Project bad_json_parsers tested how JSON parser libraries react on deeply nested inputs. It turns out that this library segfaulted at a certain nesting depth. This bug was fixed with this release. Now the parsing is only bounded by the available memory. All changes are backward-compatible.

    🐛 Bug Fixes

    • Fixed a bug that lead to stack overflow for deeply nested JSON values (objects, array) by changing the implementation of the destructor from a recursive to an iterative approach. #832, #1419, #1835

    🔨 Further Changes

    • Added WhiteStone Bolt. #1830

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.7.1

    Files

    Release date: 2019-11-06 SHA-256: b5ba7228f3c22a882d379e93d08eab4349458ee16fbf45291347994eac7dc7ce (json.hpp), 77b9f54b34e7989e6f402afb516f7ff2830df551c3a36973085e2c7a6b1045fe (include.zip)

    Summary

    This release fixes several small bugs in the library. All changes are backward-compatible.

    🐛 Bug Fixes

    • Fixed a segmentation fault when serializing std::int64_t minimum value. #1708 #1722
    • Fixed the contains() function for JSON Pointers. #1727 #1741
    • Fixed too lax SFINAE guard for conversion from std::pair and std::tuple to json. #1805 #1806 #1825 #1826
    • Fixed some regressions detected by UBSAN. Updated CI to use Clang-Tidy 7.1.0. #1716 #1728
    • Fixed integer truncation in iteration_proxy. #1797
    • Updated Hedley to v11 to fix a E2512 error in MSVC. #1799
    • Fixed a compile error in enum deserialization of non non-default-constructible types. #1647 #1821
    • Fixed the conversion from json to std::valarray.

    ⚡ Improvements

    • The items() function can now be used with a custom string type. #1765
    • Made json_pointer::back const. #1764 #1769
    • Meson is part of the release archive. #1672 #1694
    • Improved documentation on the Meson and Spack package manager. #1694 #1720

    🔨 Further Changes

    • Added GitHub Workflow with ubuntu-latest/GCC 7.4.0 as CI step.
    • Added GCC 9 to Travis CI to compile with C++20 support. #1724
    • Added MSVC 2019 to the AppVeyor CI. #1780
    • Added badge to fuzzing status.
    • Fixed some cppcheck warnings. #1760
    • Fixed several typos in the documentation. #1720 #1767 #1803
    • Added documentation on the JSON_THROW_USER, JSON_TRY_USER, and JSON_CATCH_USER macros to control user-defined exception handling.
    • Used GitHub's CODEOWNERS and SECURITY feature.
    • Removed GLOB from CMake files. #1779
    • Updated to Doctest 2.3.5.

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.7.0

    Files

    Release date: 2019-07-28 SHA-256: a503214947952b69f0062f572cb74c17582a495767446347ce2e452963fc2ca4 (json.hpp), 541c34438fd54182e9cdc68dd20c898d766713ad6d901fb2c6e28ff1f1e7c10d (include.zip)

    Summary

    This release introduces a few convenience functions and performs a lot of house keeping (bug fixes and small improvements). All changes are backward-compatible.

    ✨ New Features

    • Add overload of the contains function to check if a JSON pointer is valid without throwing exceptions, just like its counterpart for object keys. #1600
    • Add a function to_string to allow for generic conversion to strings. #916 #1585
    • Add return value for the emplace_back function, returning a reference to the added element just like C++17 is introducing this for std::vector. #1609
    • Add info how to use the library with the pacman package manager on MSYS2. #1670

    🐛 Bug Fixes

    • Fix an issue where typedefs with certain names yielded a compilation error. #1642 #1643
    • Fix a conversion to std::string_view in the unit tests. #1634 #1639
    • Fix MSVC Debug build. #1536 #1570 #1608
    • Fix get_to method to clear existing content before writing. #1511 #1555
    • Fix a -Wc++17-extensions warning. nodiscard attributes are now only used with Clang when -std=c++17 is used. #1535 #1551

    ⚡ Improvements

    🔨 Further Changes

    • Use GNUInstallDirs to set library install directories. #1673
    • Fix links in the README. #1620 #1621 #1622 #1623 #1625
    • Mention json type on the documentation start page. #1616
    • Complete documentation of value() function with respect to type_error.302 exception. #1601
    • Fix links in the documentation. #1598
    • Add regression tests for MSVC. #1543 #1570
    • Use CircleCI for continuous integration.
    • Use Doozer for continuous integration on Linux (CentOS, Raspbian, Fedora)
    • Add tests to check each CMake flag (JSON_BuildTests, JSON_Install, JSON_MultipleHeaders, JSON_Sanitizer, JSON_Valgrind, JSON_NoExceptions, JSON_Coverage).
    • Use Hedley to avoid re-inventing several compiler-agnostic feature macros like JSON_DEPRECATED, JSON_NODISCARD, JSON_LIKELY, JSON_UNLIKELY, JSON_HAS_CPP_14, or JSON_HAS_CPP_17. Functions taking or returning pointers are annotated accordingly when a pointer will not be null.
    • Build and run tests on AppVeyor in DEBUG and RELEASE mode.

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.6.1

    Files

    Release date: 2019-03-20 SHA-256: d2eeb25d2e95bffeb08ebb7704cdffd2e8fca7113eba9a0b38d60a5c391ea09a (json.hpp), 69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf (include.zip)

    Summary

    This release fixes a regression and a bug introduced by the earlier 3.6.0 release. All changes are backward-compatible.

    🐛 Bug Fixes

    • Fixed regression of #590 which could lead to compilation errors with GCC 7 and GCC 8. #1530
    • Fixed a compilation error when <Windows.h> was included. #1531

    🔨 Further Changes

    • Fixed a warning for missing field initializers. #1527

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.6.0

    Files

    Release date: 2019-03-20 SHA-256: ce9839370f28094c71107c405affb3b08c4a098154988014cbb0800b1c44a831 (json.hpp), 237c5e66e7f8186a02804ce9dbd5f69ce89fe7424ef84adf6142e973bd9532f4 (include.zip)

    ℹ️ This release introduced a regression. Please update to version 3.6.1!

    Summary

    This release adds some convenience functions for JSON Pointers, introduces a contains function to check if a key is present in an object, and improves the performance of integer serialization. Furthermore, a lot of small bug fixes and improvements have been made. All changes are backward-compatible.

    ✨ New Features

    • Overworked the public interface for JSON Pointers. The creation of JSON Pointers is simplified with operator/ and operator/=. JSON Pointers can be inspected with empty, back, and parent_pointer, and manipulated with push_back and pop_back. #1434
    • Added a boolean method contains to check whether an element exists in a JSON object with a given key. Returns false when called on non-object types. #1471 #1474

    🐛 Bug Fixes

    • Fixed a compilation issues with libc 2.12. #1483 #1514
    • Fixed endian conversion on PPC64. #1489
    • Fixed library to compile with GCC 9. #1472 #1492
    • Fixed a compilation issue with GCC 7 on CentOS. #1496
    • Fixed an integer overflow. #1447
    • Fixed buffer flushing in serializer. #1445 #1446

    ⚡ Improvements

    • The performance of dumping integers has been greatly improved. #1411
    • Added CMake parameter JSON_Install to control whether the library should be installed (default: on). #1330
    • Fixed a lot of compiler and linter warnings. #1400 #1435 #1502
    • Reduced required CMake version from 3.8 to 3.1. #1409 #1428 #1441 #1498
    • Added nodiscard attribute to meta(), array(), object(), from_cbor, from_msgpack, from_ubjson, from_bson, and parse. #1433

    🔨 Further Changes

    • Added missing headers. #1500
    • Fixed typos and broken links in README. #1417 #1423 #1425 #1451 #1455 #1491
    • Fixed documentation of parse function. #1473
    • Suppressed warning that cannot be fixed inside the library. #1401 #1468
    • Imroved package manager suppert:
      • Updated Buckaroo instructions. #1495
      • Improved Meson support. #1463
      • Added Conda package manager documentation. #1430
      • Added NuGet package manager documentation. #1132
    • Continuous Integration
      • Removed unstable or deprecated Travis builders (Xcode 6.4 - 8.2) and added Xcode 10.1 builder.
      • Added Clang 7 to Travis CI.
      • Fixed AppVeyor x64 builds. #1374 #1414
    • Updated thirdparty libraries:
      • Catch 1.12.0 -> 1.12.2
      • Google Benchmark 1.3.0 -> 1.4.1
      • Doxygen 1.8.15 -> 1.8.16

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.5.0

    Files

    Release date: 2018-12-22 SHA-256: 8a6dbf3bf01156f438d0ca7e78c2971bca50eec4ca6f0cf59adf3464c43bb9d5 (json.hpp), 3564da9c5b0cf2e032f97c69baedf10ddbc98030c337d0327a215ea72259ea21 (include.zip)

    Summary

    This release introduces the support for structured bindings and reading from FILE*. Besides, a few bugs have been fixed. All changes are backward-compatible.

    ✨ New Features

    • Structured bindings are now supported for JSON objects and arrays via the items() member function, so finally this code is possible:

      for (auto& [key, val] : j.items()) {
           std::cout << key << ':' << val << '\n';
       }
       
      #1388 #1391

    • Added support for reading from FILE* to support situations in which streams are nit available or would require too much RAM. #1370 #1392

    🐛 Bug Fixes

    • The eofbit was not set for input streams when the end of a stream was reached while parsing. #1340 #1343
    • Fixed a bug in the SAX parser for BSON arrays.

    ⚡ Improvements

    • Added support for Clang 5.0.1 (PS4 version). #1341 #1342

    🔨 Further Changes

    • Added a warning for implicit conversions to the documentation: It is not recommended to use implicit conversions when reading from a JSON value. Details about this recommendation can be found here. #1363
    • Fixed typos in the documentation. #1329 #1380 #1382
    • Fixed a C4800 warning. #1364
    • Fixed a -Wshadow warning #1346
    • Wrapped std::snprintf calls to avoid error in MSVC. #1337
    • Added code to allow installation via Meson. #1345

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.4.0

    Files

    Release date: 2018-10-30 SHA-256: 63da6d1f22b2a7bb9e4ff7d6b255cf691a161ff49532dcc45d398a53e295835f (json.hpp), bfec46fc0cee01c509cf064d2254517e7fa80d1e7647fea37cf81d97c5682bdc (include.zip)

    Summary

    This release introduces three new features:

    • BSON (Binary JSON) is next to CBOR, MessagePack, and UBJSON the fourth binary (de)serialization format supported by the library.
    • Adjustable error handlers for invalid Unicode allows to specify the behavior when invalid byte sequences are serialized.
    • Simplified enum/JSON mapping with a macro in case the default mapping to integers is not desired.

    Furthermore, some effort has been invested in improving the parse error messages. Besides, a few bugs have been fixed. All changes are backward-compatible.

    ✨ New Features

    • The library can read and write a subset of BSON (Binary JSON). All data types known from JSON are supported, whereas other types more tied to MongoDB such as timestamps, object ids, or binary data are currently not implemented. See the README for examples. #1244 #1320
    • The behavior when the library encounters an invalid Unicode sequence during serialization can now be controlled by defining one of three Unicode error handlers: (1) throw an exception (default behavior), (2) replace invalid sequences by the Unicode replacement character (U+FFFD), or (3) ignore/filter invalid sequences. See the documentation of the dump function for examples. #1198 #1314
    • To easily specify a user-defined enum/JSON mapping, a macro NLOHMANN_JSON_SERIALIZE_ENUM has been introduced. See the README section for more information. #1208 #1323

    🐛 Bug Fixes

    • fixed truncation #1286 #1315
    • fixed an issue with std::pair #1299 #1301
    • fixed an issue with std::variant #1292 #1294
    • fixed a bug in the JSON Pointer parser

    ⚡ Improvements

    • The diagnosis messages for parse errors have been improved: error messages now indicated line/column positions where possible (in addition to a byte count) and also the context in which the error occurred (e.g., "while parsing a JSON string"). Example: error parse error at 2: syntax error - invalid string: control character must be escaped; last read: '<U+0009>' is now reported as parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0009 (HT) must be escaped to \u0009 or \t; last read: '<U+0009>'. #1280 #1288 #1303

    🔨 Further Changes

    • improved Meson documentation #1305
    • fixed some more linter warnings #1280
    • fixed Clang detection for third-party Google Benchmark library #1277

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.3.0

    Files

    Release date: 2018-10-05 SHA-256: f1327bb60c58757a3dd2b0c9c45d49503d571337681d950ec621f8374bcc14d4 (json.hpp), 9588d63557333aaa485e92221ec38014a85a6134e7486fe3441e0541a5a89576 (include.zip)

    Summary

    This release adds support for GCC 4.8. Furthermore, it adds a function get_to to write a JSON value to a passed reference. Another topic of this release was the CMake support which has been overworked and documented.

    Besides, a lot of bugs have been fixed and slight improvements have been made. All changes are backward-compatible.

    ✨ New Features

    • The library can now also built with GCC 4.8. Though this compiler does not fully support C++11, it can successfully compile and run the test suite. Note that bug 57824 in GCC 4.8 still forbids to use multiline raw strings in arguments to macros. #1257
    • Added new function get_to to write a JSON value to a passed reference. The destination type is automatically derived which allows more succinct code compared to the get function. #1227 #1231

    🐛 Bug Fixes

    • Fixed a bug in the CMake file that made target_link_libraries to not properly include nlohmann_json. #1243 #1245 #1260
    • Fixed a warning in MSVC 2017 complaining about a constexpr if. #1204 #1268 #1272
    • Fixed a bug that prevented compilation with ICPC. #755 #1222
    • Improved the SFINAE correctness to fix a bug in the conversion operator. #1237 #1238
    • Fixed a -Wctor-dtor-privacy warning. #1224
    • Fixed a warning on a lambda in unevaluated context. #1225 #1230
    • Fixed a bug introduced in version 3.2.0 where defining JSON_CATCH_USER led to duplicate macro definition of JSON_INTERNAL_CATCH. #1213 #1214
    • Fixed a bug that prevented compilation with Clang 3.4.2 in RHEL 7. #1179 #1249

    ⚡ Improvements

    • Added documentation on CMake integration of the library. #1270
    • Changed the CMake file to use find_package(nlohmann_json) without installing the library. #1202
    • Improved error messages in case operator[] is used with the wrong combination (json.exception.type_error.305) of JSON container type and argument type. Example: "cannot use operator[] with a string argument". #1220 #1221
    • Added a license and version information to the Meson build file. #1252
    • Removed static assertions to indicated missing to_json or from_json functions as such assertions do not play well with SFINAE. These assertions also led to problems with GMock. #960 #1212 #1228
    • The test suite now does not wait forever if run in a wrong directory and input files are not found. #1262
    • The test suite does not show deprecation warnings for deprecated functions which frequently led to confusion. #1271

    🔨 Further Changes

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.2.0

    Files

    Release date: 2018-08-20 SHA-256: ce6b5610a051ec6795fa11c33854abebb086f0fd67c311f5921c3c07f9531b44 (json.hpp), 35ee642558b90e2f9bc758995c4788c4b4d4dec54eef95fb8f38cb4d49c8fc7c (include.zip)

    Summary

    This release introduces a SAX interface to the library. While this may be a very special feature used by only few people, it allowed to unify all functions that consumed input and created some kind of JSON value. Internally, now all existing functions like parse, accept, from_cbor, from_msgpack, and from_ubjson use the SAX interface with different event processors. This allowed to separate the input processing from the value generation. Furthermore, throwing an exception in case of a parse error is now optional and up to the event processor. Finally, the JSON parser is now non-recursive (meaning it does not use the call stack, but std::vector<bool> to track the hierarchy of structured values) which allows to process nested input more efficiently.

    Furthermore, the library finally is able to parse from wide string types. This is the first step toward opening the library from UTF-8 to UTF-16 and UTF-32.

    This release further fixes several bugs in the library. All changes are backward-compatible.

    ✨ New Features

    • added a parser with a SAX interface (#971, #1153)
    • support to parse from wide string types std::wstring, std::u16string, and std::u32string; the input will be converted to UTF-8 (#1031)
    • added support for std::string_view when using C++17 (#1028)
    • allow to roundtrip std::map and std::unordered_map from JSON if key type is not convertible to string; in these cases, values are serialized to arrays of pairs (#1079, #1089, #1133, #1138)

    🐛 Bug Fixes

    • allow to create nullptr_t from JSON allowing to properly roundtrip null values (#1169)
    • allow compare user-defined string types (#1130)
    • better support for algorithms using iterators from items() (#1045, #1134)
    • added parameter to avoid compilation error with MSVC 2015 debug builds (#1114)
    • re-added accidentally skipped unit tests (#1176)
    • fixed MSVC issue with std::swap (#1168)

    ⚡ Improvements

    • key() function for iterators returns a const reference rather than a string copy (#1098)
    • binary formats CBOR, MessagePack, and UBJSON now supports float as type for floating-point numbers (#1021)

    🔨 Further Changes

    • changed issue templates
    • improved continuous integration: added builders for Xcode 9.3 and 9.4, added builders for GCC 8 and Clang 6, added builder for MinGW, added builders for MSVC targeting x86
    • required CMake version is now at least 3.8 (#1040)
    • overworked CMake file wrt. packaging (#1048)
    • added package managers: Spack (#1041) and CocoaPods (#1148)
    • fixed Meson include directory (#1142)
    • preprocessor macro JSON_SKIP_UNSUPPORTED_COMPILER_CHECK can skip the rejection of unsupported compilers - use at your own risk! (#1128)
    • preprocessor macro JSON_INTERNAL_CATCH/JSON_INTERNAL_CATCH_USER allows to control the behavior of exception handling inside the library (#1187)
    • added note on char to JSON conversion
    • added note how to send security-related issue via encrypted email
    • removed dependency to std::stringstream (#1117)
    • added SPDX-License-Identifier
    • added updated JSON Parsing Test Suite, described in Parsing JSON is a Minefield 💣
    • updated to Catch 1.12.0

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.1.2

    Files

    Release date: 2018-03-14 SHA-256: fbdfec4b4cf63b3b565d09f87e6c3c183bdd45c5be1864d3fcb338f6f02c1733 (json.hpp), 495362ee1b9d03d9526ba9ccf1b4a9c37691abe3a642ddbced13e5778c16660c (include.zip)

    Summary

    This release fixes several bugs in the library. All changes are backward-compatible.

    🐛 Bug Fixes

    • Fixed a memory leak occurring in the parser callback (#1001).
    • Different specializations of basic_json (e.g., using different template arguments for strings or objects) can now be used in assignments (#972, #977, #986).
    • Fixed a logical error in an iterator range check (#992).

    ⚡ Improvements

    • The parser and the serialization now support user-defined string types (#1006, #1009).

    🔨 Further Changes

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.1.1

    Files

    Release date: 2018-02-13 SHA-256: e14ce5e33d6a2daf748026bd4947f3d9686ca4cfd53d10c3da46a0a9aceb7f2e (json.hpp), fde771d4b9e4f222965c00758a2bdd627d04fb7b59e09b7f3d1965abdc848505 (include.zip)

    Summary

    This release fixes several bugs in the library. All changes are backward-compatible.

    🐛 Bug Fixes

    • Fixed parsing of CBOR strings with indefinite length (#961). Earlier versions of this library misinterpreted the CBOR standard and rejected input with the 0x7F start byte.
    • Fixed user-defined conversion to vector type (#924, #969). A wrong SFINAE check rejected code though a user-defined conversion was provided.
    • Fixed documentation of the parser behavior for objects with duplicate keys (#963). The exact behavior is not specified by RFC 8259 and the library now also provides no guarantee which object key is stored.
    • Added check to detect memory overflow when parsing UBJSON containers (#962). The optimized UBJSON format allowed for specifying an array with billions of null elements with a few bytes and the library did not check whether this size exceeded max_size().

    🔨 Further Changes

    • Code coverage is now calculated for the individual header files, allowing to find uncovered lines more quickly than by browsing through the single header version (#953, #957).
    • A Makefile target run_benchmarks was added to quickly build and run the benchmark suite.
    • The documentation was harmonized with respect to the header inclusion (#955). Now all examples and the README use #include <nlohmann/json.hpp> to allow for selecting single_include or include or whatever installation folder as include directory.
    • Added note on how to use the library with the cget package manager (#954).

    🔥 Deprecated functions

    This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

    v3.1.0

    Files

    Release date: 2018-02-01 SHA-256: d40f614d10a6e4e4e80dca9463da905285f20e93116c36d97d4dc1aa63d10ba4 (json.hpp), 2b7234fca394d1e27b7e017117ed80b7518fafbb4f4c13a7c069624f6f924673 (include.zip)

    Summary

    This release adds support for the UBJSON format and JSON Merge Patch. It also contains some minor changes and bug fixes. All changes are backward-compatible.

    ✨ New features

    • The library now supports UBJSON (Universal Binary JSON Specification) as binary format to read and write JSON values space-efficiently. See the documentation overview for a comparison of the different formats CBOR, MessagePack, and UBJSON.
    • JSON Merge Patch (RFC 7386) offers an intuitive means to describe patches between JSON values (#876, #877). See the documentation of merge_patch for more information.

    ⚡ Improvements

    • The library now uses the Grisu2 algorithm for printing floating-point numbers (based on the reference implementation by Florian Loitsch) which produces a short representation which is guaranteed to round-trip (#360, #935, #936).
    • The UTF-8 handling was further simplified by using the decoder of Björn Hoehrmann in more scenarios.

    🚚 Reorganization

    • Though the library is released as a single header, its development got more and more complicated. With this release, the header is split into several files and the single-header file json.hpp can be generated from these development sources. In the repository, folder include contains the development sources and single_include contains the single json.hpp header (#700, #906, #907, #910, #911, #915, #920, #924, #925, #928, #944).
    • The split further allowed for a forward declaration header include/nlohmann/json_fwd.hpp to speed up compilation times (#314).

    🔨 Further changes

    • Google Benchmark is now used for micro benchmarks (see benchmarks folder, #921).
    • The serialization (JSON and binary formats) now properly work with the libraries string template parameter, allowing for optimized string implementations to be used in constraint environments such as embedded software (#941, #950).
    • The exceptional behavior can now be overridden by defining macros JSON_THROW_USER, JSON_TRY_USER, and JSON_CATCH_USER, defining the behavior of throw, try and catch, respectively. This allows to switch off C++'s exception mechanism yet still execute user-defined code in case an error condition occurs (#938).
    • To facilitate the interplay with flex and Bison, the library does not use the variable name yytext any more as it could clash with macro definitions (#933).
    • The library now defines NLOHMANN_JSON_VERSION_MAJOR, NLOHMANN_JSON_VERSION_MINOR, and NLOHMANN_JSON_VERSION_PATCH to allow for conditional compilation based on the included library version (#943, #948).
    • A compilation error with ICC has been fixed (#947).
    • Typos and links in the documentation have been fixed (#900, #930).
    • A compiler error related to incomplete types has been fixed (#919).
    • The tests form the UTF-8 decoder stress test have been added to the test suite.

    🔥 Deprecated functions

    • Function iterator_wrapper has been deprecated (#874). Since its introduction, the name was up for discussion, as it was too technical. We now introduced the member function items() with the same semantics. iterator_wrapper will be removed in the next major version (i.e., 4.0.0).

    Furthermore, the following functions are deprecated since version 3.0.0 and will be removed in the next major version (i.e., 4.0.0):

    Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.

    v3.0.1

    Files

    Release date: 2017-12-29 SHA-256: c9b3591f1bb94e723a0cd7be861733a3a555b234ef132be1e9027a0364118c4c

    Summary

    This release fixes small issues in the implementation of JSON Pointer and JSON Patch. All changes are backward-compatible.

    Changes

    • 🐛 The "copy" operation of JSON Patch (RFC 6902) requests that it is an error if the target path points into a non-existing array or object (see #894 for a detailed description). This release fixes the implementation to detect such invalid target paths and throw an exception.
    • 🐛 An array index in a JSON Pointer (RFC 6901) must be an integer. This release fixes the implementation to throw an exception in case invalid array indices such as 10e2 are used.
    • ✅ Added the JSON Patch tests from Byron Ruth and Mike McCabe.
    • 📝 Fixed the documentation of the at(ptr) function with JSON Pointers to list all possible exceptions (see #888).
    • 📝 Updated the container overview documentation (see #883).
    • 🔧 The CMake files now respect the BUILD_TESTING option (see #846, #885)
    • 🚨 Fixed some compiler warnings (see #858, #882).

    Deprecated functions

    🔥 To unify the interfaces and to improve similarity with the STL, the following functions are deprecated since version 3.0.0 and will be removed in the next major version (i.e., 4.0.0):

    Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.

    v3.0.0

    Files

    Release date: 2017-12-17 SHA-256: 076d4a0cb890a3c3d389c68421a11c3d77c64bd788e85d50f1b77ed252f2a462

    Summary

    After almost a year, here is finally a new release of JSON for Modern C++, and it is a major one! As we adhere to semantic versioning, this means the release includes some breaking changes, so please read the next section carefully before you update. But don't worry, we also added a few new features and put a lot of effort into fixing a lot of bugs and straighten out a few inconsistencies.

    💥 Breaking changes

    This section describes changes that change the public API of the library and may require changes in code using a previous version of the library. In section "Moving from 2.x.x to 3.0.0" at the end of the release notes, we describe in detail how existing code needs to be changed.

    • The library now uses user-defined exceptions instead of re-using those defined in <stdexcept> (#244). This not only allows to add more information to the exceptions (every exception now has an identifier, and parse errors contain the position of the error), but also to easily catch all library exceptions with a single catch(json::exception).
    • When strings with a different encoding as UTF-8 were stored in JSON values, their serialization could not be parsed by the library itself, as only UTF-8 is supported. To enforce this library limitation and improve consistency, non-UTF-8 encoded strings now yield a json::type_error exception during serialization (#838). The check for valid UTF-8 is realized with code from Björn Hoehrmann.
    • NaN and infinity values can now be stored inside the JSON value without throwing an exception. They are, however, still serialized as null (#388).
    • The library's iterator tag was changed from RandomAccessIterator to BidirectionalIterator (#593). Supporting RandomAccessIterator was incorrect as it assumed an ordering of values in a JSON objects which are unordered by definition.
    • The library does not include the standard headers <iostream>, <ctype>, and <stdexcept> any more. You may need to add these headers to code relying on them.
    • Removed constructor explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr) which was deprecated in version 2.0.0 (#480).

    🔥 Deprecated functions

    To unify the interfaces and to improve similarity with the STL, the following functions are now deprecated and will be removed in the next major version (i.e., 4.0.0):

    Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.

    ✨ New features

    With all this breaking and deprecation out of the way, let's talk about features!

    • We improved the diagnostic information for syntax errors (#301). Now, an exception json::parse_error is thrown which contains a detailed message on the error, but also a member byte to indicate the byte offset in the input where the error occurred.
    • We added a non-throwing syntax check (#458): The new accept function returns a Boolean indicating whether the input is proper JSON. We also added a Boolean parameter allow_exceptions to the existing parse functions to return a discarded value in case a syntax error occurs instead of throwing an exception.
    • An update function was added to merge two JSON objects (#428). In case you are wondering: the name was inspired by Python.
    • The insert function now also supports an iterator range to add elements to an object.
    • The binary exchange formats CBOR and MessagePack can now be parsed from input streams and written to output streams (#477).
    • Input streams are now only read until the end of a JSON value instead of the end of the input (#367).
    • The serialization function dump now has two optional parameters ensure_ascii to escape all non-ASCII characters with \uxxxx and an indent_char parameter to choose whether to indent with spaces or tabs (#654).
    • Added built-in type support for C arrays (#502), std::pair and std::tuple (#563, #614), enum and enum class (#545), std::vector<bool> (#494). Fixed support for std::valarray (#702), std::array (#553), and std::map<std::string, std::string> (#600, #607).

    🔨 Further changes

    Furthermore, there have been a lot of changes under the hood:

    • Replaced the re2c generated scanner by a self-coded version which allows for a better modularization of the parser and better diagnostics. To test the new scanner, we added millions (8,860,608 to be exact) of unit tests to check all valid and invalid byte sequences of the Unicode standard.
    • Google's OSS-Fuzz is still constantly fuzz-testing the library and found several issues that were fixed in this release (#497, #504, #514, #516, #518, #519, #575).
    • We now also ignore UTF-8 byte order marks when parsing from an iterator range (#602).
    • Values can be now moved from initializer lists (#663).
    • Updated to Catch 1.9.7. Unfortunately, Catch2 currently has some performance issues.
    • The non-exceptional paths of the library are now annotated with __builtin_expect to optimize branch prediction as long as no error occurs.
    • MSVC now produces a stack trace in MSVC if a from_json or to_json function was not found for a user-defined type. We also added a debug visualizer nlohmann_json.natvis for better debugging in MSVC (#844).
    • Overworked the documentation and added even more examples.
    • The build workflow now relies on CMake and CTest. Special flags can be chosen with CMake, including coverage (JSON_Coverage), compilation without exceptions (JSON_NoExceptions), LLVM sanitizers (JSON_Sanitizer), or execution with Valgrind (JSON_Valgrind).
    • Added support for package managers Meson (#576), Conan (#566), Hunter (#671, #829), and vcpkg (#753).
    • Added CI builders: Xcode 8.3, 9.0, 9.1, and 9.2; GCC 7.2; Clang 3.8, 3.9, 4.0, and 5.0; Visual Studio 2017. The library is further built with C++17 settings on the latest Clang, GCC, and MSVC version to quickly detect new issues.

    Moving from 2.x.x to 3.0.0

    User-defined Exceptions

    There are five different exceptions inheriting from json::exception:

    To support these exception, the try/catch blocks of your code need to be adjusted:

    new exception previous exception
    parse_error.101 invalid_argument
    parse_error.102 invalid_argument
    parse_error.103 invalid_argument
    parse_error.104 invalid_argument
    parse_error.105 invalid_argument
    parse_error.106 domain_error
    parse_error.107 domain_error
    parse_error.108 domain_error
    parse_error.109 invalid_argument
    parse_error.110 out_of_range
    parse_error.111 invalid_argument
    parse_error.112 invalid_argument
    invalid_iterator.201 domain_error
    invalid_iterator.202 domain_error
    invalid_iterator.203 domain_error
    invalid_iterator.204 out_of_range
    invalid_iterator.205 out_of_range
    invalid_iterator.206 domain_error
    invalid_iterator.207 domain_error
    invalid_iterator.208 domain_error
    invalid_iterator.209 domain_error
    invalid_iterator.210 domain_error
    invalid_iterator.211 domain_error
    invalid_iterator.212 domain_error
    invalid_iterator.213 domain_error
    invalid_iterator.214 out_of_range
    type_error.301 domain_error
    type_error.302 domain_error
    type_error.303 domain_error
    type_error.304 domain_error
    type_error.305 domain_error
    type_error.306 domain_error
    type_error.307 domain_error
    type_error.308 domain_error
    type_error.309 domain_error
    type_error.310 domain_error
    type_error.311 domain_error
    type_error.313 domain_error
    type_error.314 domain_error
    type_error.315 domain_error
    out_of_range.401 out_of_range
    out_of_range.402 out_of_range
    out_of_range.403 out_of_range
    out_of_range.404 out_of_range
    out_of_range.405 domain_error
    other_error.501 domain_error

    Handling of NaN and INF

    • If an overflow occurs during parsing a number from a JSON text, an exception json::out_of_range is thrown so that the overflow is detected early and roundtripping is guaranteed.

    • NaN and INF floating-point values can be stored in a JSON value and are not replaced by null. That is, the basic_json class behaves like double in this regard (no exception occurs). However, NaN and INF are serialized to null.

    Removal of deprecated functions

    Function explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr) should be replaced by the parse function: Let ss be a stream and cb be a parse callback function.

    Old code:

    json j(ss, cb);
    @@ -7,4 +7,4 @@
     j << ss;
     

    or

    json j;
     ss >> j;
    -

    v2.1.1

    Files

    Release date: 2017-02-25 SHA-256: faa2321beb1aa7416d035e7417fcfa59692ac3d8c202728f9bcc302e2d558f57

    Summary

    This release fixes a locale-related bug in the parser. To do so, the whole number handling (lexer, parser, and also the serialization) have been overworked. Furthermore, a lot of small changes added up that were added to this release. All changes are backward-compatible.

    Changes

    • 🐛 Locales that have a different character than . as decimal separator (e.g., the Norwegian locale nb_NO.UTF-8) led to truncated number parsing or parse errors. The library now has been fixed to work with any locale. Note that . is still the only valid decimal separator for JSON input.
    • 🐛 Numbers like 1.0 were correctly parsed as floating-point number, but serialized as integer (1). Now, floating-point numbers correctly round trip.
    • 🐛 Parsing incorrect JSON numbers with leading 0 (0123) could yield a buffer overflow. This is fixed now by detecting such errors directly by the lexer.
    • 🐛 Constructing a JSON value from a pointer was incorrectly interpreted as a Boolean; such code will now yield a compiler error.
    • 🐛 Comparing a JSON number with 0 led to a comparison with null. This is fixed now.
    • 🐛 All throw calls are now wrapped in macros.
    • 🔒 Starting during the preparation of this release (since 8 February 2017), commits and released files are cryptographically signed with this GPG key. Previous releases have also been signed.
    • ✨ The parser for MessagePack and CBOR now supports an optional start index parameter to define a byte offset for the parser.
    • 🚨 Some more warnings have been fixed. With Clang, the code compiles without warnings with -Weverything (well, it needs -Wno-documentation-unknown-command and -Wno-deprecated-declarations, but you get the point).
    • 🔨 The code can be compiled easier with many Android NDKs by avoiding macros like UINT8_MAX which previously required defining a preprocessor macro for compilation.
    • ⚡ The unit tests now compile two times faster.
    • ➕ Cotire is used to speed up the build.
    • ✏ Fixed a lot of typos in the documentation.
    • 📝 Added a section to the README file that lists all used third-party code/tools.
    • 📝 Added a note on constructing a string value vs. parsing.
    • ✅ The test suite now contains 11202597 unit tests.
    • 📝 Improved the Doxygen documentation by shortening the template parameters of class basic_json.
    • 👷 Removed Doozer.
    • 👷 Added Codacity.
    • ⬆ Upgraded Catch to version 1.7.2.

    v2.1.0

    Files

    • Release date: 2017-01-28
    • SHA-256: a571dee92515b685784fd527e38405cf3f5e13e96edbfe3f03d6df2e363a767b

    Summary

    This release introduces a means to convert from/to user-defined types. The release is backwards compatible.

    conversion

    Changes

    • ✨ The library now offers an elegant way to convert from and to arbitrary value types. All you need to do is to implement two functions: to_json and from_json. Then, a conversion is as simple as putting a = between variables. See the README for more information and examples.
    • ✨ Exceptions can now be switched off. This can be done by defining the preprocessor symbol JSON_NOEXCEPTION or by passing -fno-exceptions to your compiler. In case the code would usually thrown an exception, abort() is now called.
    • ✨ Information on the library can be queried with the new (static) function meta() which returns a JSON object with information on the version, compiler, and platform. See the documentation for an example.
    • 🐛 A bug in the CBOR parser was fixed which led to a buffer overflow.
    • ✨ The function type_name() is now public. It allows to query the type of a JSON value as string.
    • ✅ Added the Big List of Naughty Strings as test case.
    • ⬆ Updated to Catch v1.6.0.
    • 📝 Some typos in the documentation have been fixed.

    v2.0.10

    Files

    • Release date: 2017-01-02
    • SHA-256: ec27d4e74e9ce0f78066389a70724afd07f10761009322dc020656704ad5296d

    Summary

    This release fixes several security-relevant bugs in the MessagePack and CBOR parsers. The fixes are backwards compatible.

    Changes

    • 🐛 Fixed a lot of bugs in the CBOR and MesssagePack parsers. These bugs occurred if invalid input was parsed and then could lead in buffer overflows. These bugs were found with Google's OSS-Fuzz, see #405, #407, #408, #409, #411, and #412 for more information.
    • 👷 We now also use the Doozer continuous integration platform.
    • 👷 The complete test suite is now also run with Clang's address sanitizer and undefined-behavior sanitizer.
    • ✅ Overworked fuzz testing; CBOR and MessagePack implementations are now fuzz-tested. Furthermore, all fuzz tests now include a round trip which ensures created output can again be properly parsed and yields the same JSON value.
    • 📝 Clarified documentation of find() function to always return end() when called on non-object value types.
    • 🔨 Moved thirdparty test code to test/thirdparty directory.

    v2.0.9

    Files

    • Release date: 2016-12-16
    • SHA-256: fbf3396f13e187d6c214c297bddc742d918ea9b55e10bfb3d9f458b9bfdc22e5

    Summary

    This release implements with CBOR and MessagePack two binary serialization/deserialization formats. It further contains some small fixes and improvements. The fixes are backwards compatible.

    cbor

    Changes

    • ✨ The library can now read and write the binary formats CBOR (Concise Binary Object Representation) and MessagePack. Both formats are aimed to produce a very compact representation of JSON which can be parsed very efficiently. See the README file for more information and examples.
    • 🔥 simplified the iteration implementation allowing to remove dozens of lines of code
    • 🐛 fixed an integer overflow error detected by Google's OSS-Fuzz
    • 🐛 suppressed documentation warnings inside the library to facilitate compilation with -Wdocumentation
    • 🐛 fixed an overflow detection error in the number parser
    • 📝 updated contribution guidelines to a list of frequentely asked features that will most likely be never added to the library
    • 📝 added a table of contents to the README file to add some structure
    • 📝 mentioned the many examples and the documentation in the README file
    • 🔨 split unit tests into individual independent binaries to speed up compilation and testing
    • ✅ the test suite now contains 11201886 tests

    v2.0.8

    Files

    • Release date: 2016-12-02
    • SHA-256: b70db0ad34f8e0e61dc3f0cbab88099336c9674c193d8a3439d93d6aca2d7120

    Summary

    This release combines a lot of small fixes and improvements. The fixes are backwards compatible.

    Changes

    • 🐛 fixed a bug that froze the parser if a passed file was not found (now, std::invalid_argument is thrown)
    • 🐛 fixed a bug that lead to an error of a file at EOF was parsed again (now, std::invalid_argument is thrown)
    • ✨ the well known functions emplace and emplace_back have been added to JSON values and work as expected
    • ⚡ improved the performance of the serialization (dump function)
    • ⚡ improved the performance of the deserialization (parser)
    • 👷 some continuous integration images at Travis were added and retired; see here for the current continuous integration setup
    • 👷 the Coverity scan works again
    • 📈 the benchmarking code has been improved to produce more stable results
    • 📝 the README file has been extended and includes more frequently asked examples
    • ✅ the test suite now contains 8905518 tests
    • ⬆ updated Catch to version 1.5.8

    v2.0.7

    Files

    • Release date: 2016-11-02
    • SHA-256: 5545c323670f8165bae90b9dc6078825e86ec310d96cc4e5b47233ea43715bbf

    Summary

    This release fixes a few bugs in the JSON parser found in the Parsing JSON is a Minefield 💣 article. The fixes are backwards compatible.

    Changes

    • The article Parsing JSON is a Minefield 💣 discusses a lot of pitfalls of the JSON specification. When investigating the published test cases, a few bugs in the library were found and fixed:
    • Files with less than 5 bytes can now be parsed without error.
    • The library now properly rejects any file encoding other than UTF-8. Furthermore, incorrect surrogate pairs are properly detected and rejected.
    • The library now accepts all but one "yes" test (y_string_utf16.json): UTF-16 is not supported.
    • The library rejects all but one "no" test (n_number_then_00.json): Null bytes are treated as end of file instead of an error. This allows to parse input from null-terminated strings.
    • The string length passed to a user-defined string literal is now exploited to choose a more efficient constructor.
    • A few grammar mistakes in the README file have been fixed.

    v2.0.6

    Files

    • Release date: 2016-10-15
    • SHA256: 459cc93d5e2f503e50c6d5876eb86bfea7daf405f5a567c5a2c9abc2383756ae

    Summary

    This release fixes the semantics of operator[] for JSON Pointers (see below). This fix is backwards compatible.

    Changes

    • operator[] for JSON Pointers now behaves like the other versions of operator[] and transforms null values into objects or arrays if required. This allows to created nested structures like j["/foo/bar/2"] = 17 (yielding {"foo": "bar": [null, null, 17]}) without problems.
    • overworked a helper SFINAE function
    • fixed some documentation issues
    • fixed the CMake files to allow to run the test suite outside the main project directory
    • restored test coverage to 100%.

    v2.0.5

    Files

    • Release date: 2016-09-14
    • SHA-256: 8b7565263a44e2b7d3b89808bc73d2d639037ff0c1f379e3d56dbd77e00b98d9

    Summary

    This release fixes a regression bug in the stream parser (function parse() and the <</>> operators). This fix is backwards compatible.

    Changes

    • Bug fix: The end of a file stream was not detected properly which led to parse errors. This bug should have been fixed with 2.0.4, but there was still a flaw in the code.

    v2.0.4

    Files

    • Release date: 2016-09-11
    • SHA-256: 632ceec4c25c4e2153f71470d3a2b992c8355f6d8b4d627d05dd16095cd3aeda

    Summary

    This release fixes a bug in the stream parser (function parse() and the <</>> operators). This fix is backwards compatible.

    Changes

    • Bug fix: The end of a file stream was not detected properly which led to parse errors.
    • Fixed a compiler warning about an unused variable.

    v2.0.3

    Files

    • Release date: 2016-08-31
    • SHA-256: 535b73efe5546fde9e763c14aeadfc7b58183c0b3cd43c29741025aba6cf6bd3

    Summary

    This release combines a lot of small fixes and improvements. The release is backwards compatible.

    Changes

    • The parser/deserialization functions have been generalized to process any contiguous sequence of 1-byte elements (e.g., char, unsigned char, uint8_t). This includes all kind of string representations (string literals, char arrays, std::string, const char*), contiguous containers (C-style arrays, std::vector, std::array, std::valarray, std::initializer_list). User-defined containers providing random-access iterator access via std::begin and std::end can be used as well. See the documentation (1, 2, 3, 4) for more information. Note that contiguous storage cannot be checked at compile time; if any of the parse functions are called with a noncompliant container, the behavior is undefined and will most likely yield segmentation violation. The preconditions are enforced by an assertion unless the library is compiled with preprocessor symbol NDEBUG.
    • As a general remark on assertions: The library uses assertions to preclude undefined behavior. A prominent example for this is the operator[] for const JSON objects. The behavior of this const version of the operator is undefined if the given key does not exist in the JSON object, because unlike the non-const version, it cannot add a null value at the given key. Assertions can be switched of by defining the preprocessor symbol NDEBUG. See the documentation of assert for more information.
    • In the course of cleaning up the parser/deserialization functions, the constructor basic_json(std::istream&, const parser_callback_t) has been deprecated and will be deleted with the next major release 3.0.0 to unify the interface of the library. Deserialization will be done by stream operators or by calling one of the parse functions. That is, calls like json j(i); for an input stream i need to be replaced by json j = json::parse(i);. Compilers will produce a deprecation warning if client code uses this function.
    • Minor improvements:
    • Improved the performance of the serialization by avoiding the re-creation of a locale object.
    • Fixed two MSVC warnings. Compiling the test suite with /Wall now only warns about non-inlined functions (C4710) and the deprecation of the constructor from input-stream (C4996).
    • Some project internals:
    • The project has qualified for the Core Infrastructure Initiative Best Practices Badge. While most requirements where already satisfied, some led to a more explicit documentation of quality-ensuring procedures. For instance, static analysis is now executed with every commit on the build server. Furthermore, the contribution guidelines document how to communicate security issues privately.
    • The test suite has been overworked and split into several files to allow for faster compilation and analysis. The execute the test suite, simply execute make check.
    • The continuous integration with Travis was extended with Clang versions 3.6.0 to 3.8.1 and now includes 18 different compiler/OS combinations.
    • An 11-day run of American fuzzy lop checked 962 million inputs on the parser and found no issue.

    v2.0.2

    Files

    • Release date: 2016-07-31
    • SHA-256: 8e97b7965b4594b00998d6704465412360e1a0ed927badb51ded8b82291a8f3d

    Summary

    This release combines a lot of small fixes and improvements. The release is backwards compatible.

    Changes

    • The parser has been overworked, and a lot of small issues have been fixed:
    • Improved parser performance by avoiding recursion and using move semantics for the return value.
    • Unescaped control characters \x10-\x1f are not accepted any more.
    • Fixed a bug in the parser when reading from an input stream.
    • Improved test case coverage for UTF-8 parsing: now, all valid Unicode code points are tested both escaped and unescaped.
    • The precision of output streams is now preserved by the parser.
    • Started to check the code correctness by proving termination of important loops. Furthermore, individual assertions have been replaced by a more systematic function which checks the class invariants. Note that assertions should be switched off in production by defining the preprocessor macro NDEBUG, see the documentation of assert.
    • A lot of code cleanup: removed unused headers, fixed some compiler warnings, and fixed a build error for Windows-based Clang builds.
    • Added some compile-time checks:
    • Unsupported compilers are rejected during compilation with an #error command.
    • Static assertion prohibits code with incompatible pointer types used in get_ptr().
    • Improved the documentation, and adjusted the documentation script to choose the correct version of sed.
    • Replaced a lot of "raw loops" by STL functions like std::all_of, std::for_each, or std::accumulate. This facilitates reasoning about termination of loops and sometimes allowed to simplify functions to a single return statement.
    • Implemented a value() function for JSON pointers (similar to at function).
    • The Homebrew formula (see Integration) is now tested for all Xcode builds (6.1 - 8.x) with Travis.
    • Avoided output to std::cout in the test cases.

    v2.0.1

    Files

    • Release date: 2016-06-28
    • SHA-256: ef550fcd7df572555bf068e9ec4e9d3b9e4cdd441cecb0dcea9ea7fd313f72dd

    Summary

    This release fixes a performance regression in the JSON serialization (function dump()). This fix is backwards compatible.

    Changes

    • The locale of the output stream (or the internal string stream if a JSON value is serialized to a string) is now adjusted once for the whole serialization instead of for each floating-point number.
    • The locale of an output stream is now correctly reset to the previous value by the JSON library.

    v2.0.0

    Files

    • Release date: 2016-06-24
    • SHA-256: ac9e1fb25c2ac9ca5fc501fcd2fe3281fe04f07018a1b48820e7b1b11491bb6c

    Summary

    This release adds several features such as JSON Pointers, JSON Patch, or support for 64 bit unsigned integers. Furthermore, several (subtle) bugs have been fixed.

    As noexcept and constexpr specifier have been added to several functions, the public API has effectively been changed in a (potential) non-backwards compatible manner. As we adhere to Semantic Versioning, this calls for a new major version, so say hello to 2️⃣.0️⃣.0️⃣.

    Changes

    • 🔟 A JSON value now uses uint64_t (default value for template parameter NumberUnsignedType) as data type for unsigned integer values. This type is used automatically when an unsigned number is parsed. Furthermore, constructors, conversion operators and an is_number_unsigned() test have been added.
    • 👉 JSON Pointer (RFC 6901) support: A JSON Pointer is a string (similar to an XPath expression) to address a value inside a structured JSON value. JSON Pointers can be used in at() and operator[] functions. Furthermore, JSON values can be “flattened” to key/value pairs using flatten() where each key is a JSON Pointer. The original value can be restored by “unflattening” the flattened value using unflatten().
    • 🏥 JSON Patch (RFC 6902) support. A JSON Patch is a JSON value that describes the required edit operations (add, change, remove, …) to transform a JSON value into another one. A JSON Patch can be created with function diff(const basic_json&) and applied with patch(const basic_json&). Note the created patches use a rather primitive algorithm so far and leave room for improvement.
    • 🇪🇺 The code is now locale-independent: Floating-point numbers are always serialized with a period (.) as decimal separator and ignores different settings from the locale.
    • 🍺 Homebrew support: Install the library with brew tap nlohmann/json && brew install nlohmann_json.
    • Added constructor to create a JSON value by parsing a std::istream (e.g., std::stringstream or std::ifstream).
    • Added noexcept specifier to basic_json(boolean_t), basic_json(const number_integer_t), basic_json(const int), basic_json(const number_float_t), iterator functions (begin(), end(), etc.)
    • When parsing numbers, the sign of 0.0 (vs. -0.0) is preserved.
    • Improved MSVC 2015, Android, and MinGW support. See README for more information.
    • Improved test coverage (added 2,225,386 tests).
    • Removed some misuses of std::move.
    • Fixed several compiler warnings.
    • Improved error messages from JSON parser.
    • Updated to re2c to version 0.16 to use a minimal DFAs for the lexer.
    • Updated test suite to use Catch version 1.5.6.
    • Made type getters (is_number, etc.) and const value access constexpr.
    • Functions push_back and operator+= now work with key/value pairs passed as initializer list, e.g. j_object += {"key", 1}.
    • Overworked CMakeLists.txt to make it easier to integrate the library into other projects.

    Notes

    • Parser error messages are still very vague and contain no information on the error location.
    • The implemented diff function is rather primitive and does not create minimal diffs.
    • The name of function iteration_wrapper may change in the future and the function will be deprecated in the next release.
    • Roundtripping (i.e., parsing a JSON value from a string, serializing it, and comparing the strings) of floating-point numbers is not 100% accurate. Note that RFC 8259 defines no format to internally represent numbers and states not requirement for roundtripping. Nevertheless, benchmarks like Native JSON Benchmark treat roundtripping deviations as conformance errors.

    v1.1.0

    Files

    • Release date: 2016-01-24
    • SHA-256: c0cf0e3017798ca6bb18e757ebc570d21a3bdac877845e2b9e9573d183ed2f05

    Summary

    This release fixes several small bugs and adds functionality in a backwards-compatible manner. Compared to the last version (1.0.0), the following changes have been made:

    Changes

    • Fixed: Floating-point numbers are now serialized and deserialized properly such that rountripping works in more cases. [#185, #186, #190, #191, #194]
    • Added: The code now contains assertions to detect undefined behavior during development. As the standard function assert is used, the assertions can be switched off by defining the preprocessor symbol NDEBUG during compilation. [#168]
    • Added: It is now possible to get a reference to the stored values via the newly added function get_ref(). [#128, #184]
    • Fixed: Access to object values via keys (operator[]) now works with all kind of string representations. [#171, #189]
    • Fixed: The code now compiles again with Microsoft Visual Studio 2015. [#144, #167, #188]
    • Fixed: All required headers are now included.
    • Fixed: Typos and other small issues. [#162, #166, #175, #177, #179, #180]

    Notes

    There are still known open issues (#178, #187) which will be fixed in version 2.0.0. However, these fixes will require a small API change and will not be entirely backwards-compatible.

    v1.0.0

    Files

    • Release date: 2015-12-28
    • SHA-256: 767dc2fab1819d7b9e19b6e456d61e38d21ef7182606ecf01516e3f5230446de

    Summary

    This is the first official release. Compared to the prerelease version 1.0.0-rc1, only a few minor improvements have been made:

    Changes

    • Changed: A UTF-8 byte order mark is silently ignored.
    • Changed: sprintf is no longer used.
    • Changed: iterator_wrapper also works for const objects; note: the name may change!
    • Changed: Error messages during deserialization have been improved.
    • Added: The parse function now also works with type std::istream&&.
    • Added: Function value(key, default_value) returns either a copy of an object's element at the specified key or a given default value if no element with the key exists.
    • Added: Public functions are tagged with the version they were introduced. This shall allow for better versioning in the future.
    • Added: All public functions and types are documented (see http://nlohmann.github.io/json/doxygen/) including executable examples.
    • Added: Allocation of all types (in particular arrays, strings, and objects) is now exception-safe.
    • Added: They descriptions of thrown exceptions have been overworked and are part of the tests suite and documentation.
    \ No newline at end of file +

    v2.1.1

    Files

    Release date: 2017-02-25 SHA-256: faa2321beb1aa7416d035e7417fcfa59692ac3d8c202728f9bcc302e2d558f57

    Summary

    This release fixes a locale-related bug in the parser. To do so, the whole number handling (lexer, parser, and also the serialization) have been overworked. Furthermore, a lot of small changes added up that were added to this release. All changes are backward-compatible.

    Changes

    • 🐛 Locales that have a different character than . as decimal separator (e.g., the Norwegian locale nb_NO.UTF-8) led to truncated number parsing or parse errors. The library now has been fixed to work with any locale. Note that . is still the only valid decimal separator for JSON input.
    • 🐛 Numbers like 1.0 were correctly parsed as floating-point number, but serialized as integer (1). Now, floating-point numbers correctly round trip.
    • 🐛 Parsing incorrect JSON numbers with leading 0 (0123) could yield a buffer overflow. This is fixed now by detecting such errors directly by the lexer.
    • 🐛 Constructing a JSON value from a pointer was incorrectly interpreted as a Boolean; such code will now yield a compiler error.
    • 🐛 Comparing a JSON number with 0 led to a comparison with null. This is fixed now.
    • 🐛 All throw calls are now wrapped in macros.
    • 🔒 Starting during the preparation of this release (since 8 February 2017), commits and released files are cryptographically signed with this GPG key. Previous releases have also been signed.
    • ✨ The parser for MessagePack and CBOR now supports an optional start index parameter to define a byte offset for the parser.
    • 🚨 Some more warnings have been fixed. With Clang, the code compiles without warnings with -Weverything (well, it needs -Wno-documentation-unknown-command and -Wno-deprecated-declarations, but you get the point).
    • 🔨 The code can be compiled easier with many Android NDKs by avoiding macros like UINT8_MAX which previously required defining a preprocessor macro for compilation.
    • ⚡ The unit tests now compile two times faster.
    • ➕ Cotire is used to speed up the build.
    • ✏ Fixed a lot of typos in the documentation.
    • 📝 Added a section to the README file that lists all used third-party code/tools.
    • 📝 Added a note on constructing a string value vs. parsing.
    • ✅ The test suite now contains 11202597 unit tests.
    • 📝 Improved the Doxygen documentation by shortening the template parameters of class basic_json.
    • 👷 Removed Doozer.
    • 👷 Added Codacity.
    • ⬆ Upgraded Catch to version 1.7.2.

    v2.1.0

    Files

    • Release date: 2017-01-28
    • SHA-256: a571dee92515b685784fd527e38405cf3f5e13e96edbfe3f03d6df2e363a767b

    Summary

    This release introduces a means to convert from/to user-defined types. The release is backwards compatible.

    conversion

    Changes

    • ✨ The library now offers an elegant way to convert from and to arbitrary value types. All you need to do is to implement two functions: to_json and from_json. Then, a conversion is as simple as putting a = between variables. See the README for more information and examples.
    • ✨ Exceptions can now be switched off. This can be done by defining the preprocessor symbol JSON_NOEXCEPTION or by passing -fno-exceptions to your compiler. In case the code would usually thrown an exception, abort() is now called.
    • ✨ Information on the library can be queried with the new (static) function meta() which returns a JSON object with information on the version, compiler, and platform. See the documentation for an example.
    • 🐛 A bug in the CBOR parser was fixed which led to a buffer overflow.
    • ✨ The function type_name() is now public. It allows to query the type of a JSON value as string.
    • ✅ Added the Big List of Naughty Strings as test case.
    • ⬆ Updated to Catch v1.6.0.
    • 📝 Some typos in the documentation have been fixed.

    v2.0.10

    Files

    • Release date: 2017-01-02
    • SHA-256: ec27d4e74e9ce0f78066389a70724afd07f10761009322dc020656704ad5296d

    Summary

    This release fixes several security-relevant bugs in the MessagePack and CBOR parsers. The fixes are backwards compatible.

    Changes

    • 🐛 Fixed a lot of bugs in the CBOR and MesssagePack parsers. These bugs occurred if invalid input was parsed and then could lead in buffer overflows. These bugs were found with Google's OSS-Fuzz, see #405, #407, #408, #409, #411, and #412 for more information.
    • 👷 We now also use the Doozer continuous integration platform.
    • 👷 The complete test suite is now also run with Clang's address sanitizer and undefined-behavior sanitizer.
    • ✅ Overworked fuzz testing; CBOR and MessagePack implementations are now fuzz-tested. Furthermore, all fuzz tests now include a round trip which ensures created output can again be properly parsed and yields the same JSON value.
    • 📝 Clarified documentation of find() function to always return end() when called on non-object value types.
    • 🔨 Moved thirdparty test code to test/thirdparty directory.

    v2.0.9

    Files

    • Release date: 2016-12-16
    • SHA-256: fbf3396f13e187d6c214c297bddc742d918ea9b55e10bfb3d9f458b9bfdc22e5

    Summary

    This release implements with CBOR and MessagePack two binary serialization/deserialization formats. It further contains some small fixes and improvements. The fixes are backwards compatible.

    cbor

    Changes

    • ✨ The library can now read and write the binary formats CBOR (Concise Binary Object Representation) and MessagePack. Both formats are aimed to produce a very compact representation of JSON which can be parsed very efficiently. See the README file for more information and examples.
    • 🔥 simplified the iteration implementation allowing to remove dozens of lines of code
    • 🐛 fixed an integer overflow error detected by Google's OSS-Fuzz
    • 🐛 suppressed documentation warnings inside the library to facilitate compilation with -Wdocumentation
    • 🐛 fixed an overflow detection error in the number parser
    • 📝 updated contribution guidelines to a list of frequentely asked features that will most likely be never added to the library
    • 📝 added a table of contents to the README file to add some structure
    • 📝 mentioned the many examples and the documentation in the README file
    • 🔨 split unit tests into individual independent binaries to speed up compilation and testing
    • ✅ the test suite now contains 11201886 tests

    v2.0.8

    Files

    • Release date: 2016-12-02
    • SHA-256: b70db0ad34f8e0e61dc3f0cbab88099336c9674c193d8a3439d93d6aca2d7120

    Summary

    This release combines a lot of small fixes and improvements. The fixes are backwards compatible.

    Changes

    • 🐛 fixed a bug that froze the parser if a passed file was not found (now, std::invalid_argument is thrown)
    • 🐛 fixed a bug that lead to an error of a file at EOF was parsed again (now, std::invalid_argument is thrown)
    • ✨ the well known functions emplace and emplace_back have been added to JSON values and work as expected
    • ⚡ improved the performance of the serialization (dump function)
    • ⚡ improved the performance of the deserialization (parser)
    • 👷 some continuous integration images at Travis were added and retired; see here for the current continuous integration setup
    • 👷 the Coverity scan works again
    • 📈 the benchmarking code has been improved to produce more stable results
    • 📝 the README file has been extended and includes more frequently asked examples
    • ✅ the test suite now contains 8905518 tests
    • ⬆ updated Catch to version 1.5.8

    v2.0.7

    Files

    • Release date: 2016-11-02
    • SHA-256: 5545c323670f8165bae90b9dc6078825e86ec310d96cc4e5b47233ea43715bbf

    Summary

    This release fixes a few bugs in the JSON parser found in the Parsing JSON is a Minefield 💣 article. The fixes are backwards compatible.

    Changes

    • The article Parsing JSON is a Minefield 💣 discusses a lot of pitfalls of the JSON specification. When investigating the published test cases, a few bugs in the library were found and fixed:
    • Files with less than 5 bytes can now be parsed without error.
    • The library now properly rejects any file encoding other than UTF-8. Furthermore, incorrect surrogate pairs are properly detected and rejected.
    • The library now accepts all but one "yes" test (y_string_utf16.json): UTF-16 is not supported.
    • The library rejects all but one "no" test (n_number_then_00.json): Null bytes are treated as end of file instead of an error. This allows to parse input from null-terminated strings.
    • The string length passed to a user-defined string literal is now exploited to choose a more efficient constructor.
    • A few grammar mistakes in the README file have been fixed.

    v2.0.6

    Files

    • Release date: 2016-10-15
    • SHA256: 459cc93d5e2f503e50c6d5876eb86bfea7daf405f5a567c5a2c9abc2383756ae

    Summary

    This release fixes the semantics of operator[] for JSON Pointers (see below). This fix is backwards compatible.

    Changes

    • operator[] for JSON Pointers now behaves like the other versions of operator[] and transforms null values into objects or arrays if required. This allows to created nested structures like j["/foo/bar/2"] = 17 (yielding {"foo": "bar": [null, null, 17]}) without problems.
    • overworked a helper SFINAE function
    • fixed some documentation issues
    • fixed the CMake files to allow to run the test suite outside the main project directory
    • restored test coverage to 100%.

    v2.0.5

    Files

    • Release date: 2016-09-14
    • SHA-256: 8b7565263a44e2b7d3b89808bc73d2d639037ff0c1f379e3d56dbd77e00b98d9

    Summary

    This release fixes a regression bug in the stream parser (function parse() and the <</>> operators). This fix is backwards compatible.

    Changes

    • Bug fix: The end of a file stream was not detected properly which led to parse errors. This bug should have been fixed with 2.0.4, but there was still a flaw in the code.

    v2.0.4

    Files

    • Release date: 2016-09-11
    • SHA-256: 632ceec4c25c4e2153f71470d3a2b992c8355f6d8b4d627d05dd16095cd3aeda

    Summary

    This release fixes a bug in the stream parser (function parse() and the <</>> operators). This fix is backwards compatible.

    Changes

    • Bug fix: The end of a file stream was not detected properly which led to parse errors.
    • Fixed a compiler warning about an unused variable.

    v2.0.3

    Files

    • Release date: 2016-08-31
    • SHA-256: 535b73efe5546fde9e763c14aeadfc7b58183c0b3cd43c29741025aba6cf6bd3

    Summary

    This release combines a lot of small fixes and improvements. The release is backwards compatible.

    Changes

    • The parser/deserialization functions have been generalized to process any contiguous sequence of 1-byte elements (e.g., char, unsigned char, uint8_t). This includes all kind of string representations (string literals, char arrays, std::string, const char*), contiguous containers (C-style arrays, std::vector, std::array, std::valarray, std::initializer_list). User-defined containers providing random-access iterator access via std::begin and std::end can be used as well. See the documentation (1, 2, 3, 4) for more information. Note that contiguous storage cannot be checked at compile time; if any of the parse functions are called with a noncompliant container, the behavior is undefined and will most likely yield segmentation violation. The preconditions are enforced by an assertion unless the library is compiled with preprocessor symbol NDEBUG.
    • As a general remark on assertions: The library uses assertions to preclude undefined behavior. A prominent example for this is the operator[] for const JSON objects. The behavior of this const version of the operator is undefined if the given key does not exist in the JSON object, because unlike the non-const version, it cannot add a null value at the given key. Assertions can be switched of by defining the preprocessor symbol NDEBUG. See the documentation of assert for more information.
    • In the course of cleaning up the parser/deserialization functions, the constructor basic_json(std::istream&, const parser_callback_t) has been deprecated and will be deleted with the next major release 3.0.0 to unify the interface of the library. Deserialization will be done by stream operators or by calling one of the parse functions. That is, calls like json j(i); for an input stream i need to be replaced by json j = json::parse(i);. Compilers will produce a deprecation warning if client code uses this function.
    • Minor improvements:
    • Improved the performance of the serialization by avoiding the re-creation of a locale object.
    • Fixed two MSVC warnings. Compiling the test suite with /Wall now only warns about non-inlined functions (C4710) and the deprecation of the constructor from input-stream (C4996).
    • Some project internals:
    • The project has qualified for the Core Infrastructure Initiative Best Practices Badge. While most requirements where already satisfied, some led to a more explicit documentation of quality-ensuring procedures. For instance, static analysis is now executed with every commit on the build server. Furthermore, the contribution guidelines document how to communicate security issues privately.
    • The test suite has been overworked and split into several files to allow for faster compilation and analysis. The execute the test suite, simply execute make check.
    • The continuous integration with Travis was extended with Clang versions 3.6.0 to 3.8.1 and now includes 18 different compiler/OS combinations.
    • An 11-day run of American fuzzy lop checked 962 million inputs on the parser and found no issue.

    v2.0.2

    Files

    • Release date: 2016-07-31
    • SHA-256: 8e97b7965b4594b00998d6704465412360e1a0ed927badb51ded8b82291a8f3d

    Summary

    This release combines a lot of small fixes and improvements. The release is backwards compatible.

    Changes

    • The parser has been overworked, and a lot of small issues have been fixed:
    • Improved parser performance by avoiding recursion and using move semantics for the return value.
    • Unescaped control characters \x10-\x1f are not accepted any more.
    • Fixed a bug in the parser when reading from an input stream.
    • Improved test case coverage for UTF-8 parsing: now, all valid Unicode code points are tested both escaped and unescaped.
    • The precision of output streams is now preserved by the parser.
    • Started to check the code correctness by proving termination of important loops. Furthermore, individual assertions have been replaced by a more systematic function which checks the class invariants. Note that assertions should be switched off in production by defining the preprocessor macro NDEBUG, see the documentation of assert.
    • A lot of code cleanup: removed unused headers, fixed some compiler warnings, and fixed a build error for Windows-based Clang builds.
    • Added some compile-time checks:
    • Unsupported compilers are rejected during compilation with an #error command.
    • Static assertion prohibits code with incompatible pointer types used in get_ptr().
    • Improved the documentation, and adjusted the documentation script to choose the correct version of sed.
    • Replaced a lot of "raw loops" by STL functions like std::all_of, std::for_each, or std::accumulate. This facilitates reasoning about termination of loops and sometimes allowed to simplify functions to a single return statement.
    • Implemented a value() function for JSON pointers (similar to at function).
    • The Homebrew formula (see Integration) is now tested for all Xcode builds (6.1 - 8.x) with Travis.
    • Avoided output to std::cout in the test cases.

    v2.0.1

    Files

    • Release date: 2016-06-28
    • SHA-256: ef550fcd7df572555bf068e9ec4e9d3b9e4cdd441cecb0dcea9ea7fd313f72dd

    Summary

    This release fixes a performance regression in the JSON serialization (function dump()). This fix is backwards compatible.

    Changes

    • The locale of the output stream (or the internal string stream if a JSON value is serialized to a string) is now adjusted once for the whole serialization instead of for each floating-point number.
    • The locale of an output stream is now correctly reset to the previous value by the JSON library.

    v2.0.0

    Files

    • Release date: 2016-06-24
    • SHA-256: ac9e1fb25c2ac9ca5fc501fcd2fe3281fe04f07018a1b48820e7b1b11491bb6c

    Summary

    This release adds several features such as JSON Pointers, JSON Patch, or support for 64 bit unsigned integers. Furthermore, several (subtle) bugs have been fixed.

    As noexcept and constexpr specifier have been added to several functions, the public API has effectively been changed in a (potential) non-backwards compatible manner. As we adhere to Semantic Versioning, this calls for a new major version, so say hello to 2️⃣.0️⃣.0️⃣.

    Changes

    • 🔟 A JSON value now uses uint64_t (default value for template parameter NumberUnsignedType) as data type for unsigned integer values. This type is used automatically when an unsigned number is parsed. Furthermore, constructors, conversion operators and an is_number_unsigned() test have been added.
    • 👉 JSON Pointer (RFC 6901) support: A JSON Pointer is a string (similar to an XPath expression) to address a value inside a structured JSON value. JSON Pointers can be used in at() and operator[] functions. Furthermore, JSON values can be “flattened” to key/value pairs using flatten() where each key is a JSON Pointer. The original value can be restored by “unflattening” the flattened value using unflatten().
    • 🏥 JSON Patch (RFC 6902) support. A JSON Patch is a JSON value that describes the required edit operations (add, change, remove, …) to transform a JSON value into another one. A JSON Patch can be created with function diff(const basic_json&) and applied with patch(const basic_json&). Note the created patches use a rather primitive algorithm so far and leave room for improvement.
    • 🇪🇺 The code is now locale-independent: Floating-point numbers are always serialized with a period (.) as decimal separator and ignores different settings from the locale.
    • 🍺 Homebrew support: Install the library with brew tap nlohmann/json && brew install nlohmann_json.
    • Added constructor to create a JSON value by parsing a std::istream (e.g., std::stringstream or std::ifstream).
    • Added noexcept specifier to basic_json(boolean_t), basic_json(const number_integer_t), basic_json(const int), basic_json(const number_float_t), iterator functions (begin(), end(), etc.)
    • When parsing numbers, the sign of 0.0 (vs. -0.0) is preserved.
    • Improved MSVC 2015, Android, and MinGW support. See README for more information.
    • Improved test coverage (added 2,225,386 tests).
    • Removed some misuses of std::move.
    • Fixed several compiler warnings.
    • Improved error messages from JSON parser.
    • Updated to re2c to version 0.16 to use a minimal DFAs for the lexer.
    • Updated test suite to use Catch version 1.5.6.
    • Made type getters (is_number, etc.) and const value access constexpr.
    • Functions push_back and operator+= now work with key/value pairs passed as initializer list, e.g. j_object += {"key", 1}.
    • Overworked CMakeLists.txt to make it easier to integrate the library into other projects.

    Notes

    • Parser error messages are still very vague and contain no information on the error location.
    • The implemented diff function is rather primitive and does not create minimal diffs.
    • The name of function iteration_wrapper may change in the future and the function will be deprecated in the next release.
    • Roundtripping (i.e., parsing a JSON value from a string, serializing it, and comparing the strings) of floating-point numbers is not 100% accurate. Note that RFC 8259 defines no format to internally represent numbers and states not requirement for roundtripping. Nevertheless, benchmarks like Native JSON Benchmark treat roundtripping deviations as conformance errors.

    v1.1.0

    Files

    • Release date: 2016-01-24
    • SHA-256: c0cf0e3017798ca6bb18e757ebc570d21a3bdac877845e2b9e9573d183ed2f05

    Summary

    This release fixes several small bugs and adds functionality in a backwards-compatible manner. Compared to the last version (1.0.0), the following changes have been made:

    Changes

    • Fixed: Floating-point numbers are now serialized and deserialized properly such that rountripping works in more cases. [#185, #186, #190, #191, #194]
    • Added: The code now contains assertions to detect undefined behavior during development. As the standard function assert is used, the assertions can be switched off by defining the preprocessor symbol NDEBUG during compilation. [#168]
    • Added: It is now possible to get a reference to the stored values via the newly added function get_ref(). [#128, #184]
    • Fixed: Access to object values via keys (operator[]) now works with all kind of string representations. [#171, #189]
    • Fixed: The code now compiles again with Microsoft Visual Studio 2015. [#144, #167, #188]
    • Fixed: All required headers are now included.
    • Fixed: Typos and other small issues. [#162, #166, #175, #177, #179, #180]

    Notes

    There are still known open issues (#178, #187) which will be fixed in version 2.0.0. However, these fixes will require a small API change and will not be entirely backwards-compatible.

    v1.0.0

    Files

    • Release date: 2015-12-28
    • SHA-256: 767dc2fab1819d7b9e19b6e456d61e38d21ef7182606ecf01516e3f5230446de

    Summary

    This is the first official release. Compared to the prerelease version 1.0.0-rc1, only a few minor improvements have been made:

    Changes

    • Changed: A UTF-8 byte order mark is silently ignored.
    • Changed: sprintf is no longer used.
    • Changed: iterator_wrapper also works for const objects; note: the name may change!
    • Changed: Error messages during deserialization have been improved.
    • Added: The parse function now also works with type std::istream&&.
    • Added: Function value(key, default_value) returns either a copy of an object's element at the specified key or a given default value if no element with the key exists.
    • Added: Public functions are tagged with the version they were introduced. This shall allow for better versioning in the future.
    • Added: All public functions and types are documented (see http://nlohmann.github.io/json/doxygen/) including executable examples.
    • Added: Allocation of all types (in particular arrays, strings, and objects) is now exception-safe.
    • Added: They descriptions of thrown exceptions have been overworked and are part of the tests suite and documentation.
\ No newline at end of file diff --git a/home/sponsors/index.html b/home/sponsors/index.html index 65979ebec..c80a03859 100644 --- a/home/sponsors/index.html +++ b/home/sponsors/index.html @@ -1 +1 @@ - Sponsors - JSON for Modern C++
Skip to content
\ No newline at end of file + Sponsors - JSON for Modern C++
Skip to content
\ No newline at end of file diff --git a/index.html b/index.html index ca3b4da21..d67e44587 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ - JSON for Modern C++ - JSON for Modern C++
Skip to content

JSON for Modern C++

\ No newline at end of file + JSON for Modern C++ - JSON for Modern C++
Skip to content

JSON for Modern C++

\ No newline at end of file diff --git a/integration/cmake/index.html b/integration/cmake/index.html index 26318b081..37ef37003 100644 --- a/integration/cmake/index.html +++ b/integration/cmake/index.html @@ -1,4 +1,4 @@ - CMake - JSON for Modern C++
Skip to content

CMake

Integration

You can use the nlohmann_json::nlohmann_json interface target in CMake. This target populates the appropriate usage requirements for INTERFACE_INCLUDE_DIRECTORIES to point to the appropriate include directories and INTERFACE_COMPILE_FEATURES for the necessary C++11 flags.

External

To use this library from a CMake project, you can locate it directly with find_package() and use the namespaced imported target from the generated package configuration:

Example

CMakeLists.txt
cmake_minimum_required(VERSION 3.1)
+ CMake - JSON for Modern C++      

CMake

Integration

You can use the nlohmann_json::nlohmann_json interface target in CMake. This target populates the appropriate usage requirements for INTERFACE_INCLUDE_DIRECTORIES to point to the appropriate include directories and INTERFACE_COMPILE_FEATURES for the necessary C++11 flags.

External

To use this library from a CMake project, you can locate it directly with find_package() and use the namespaced imported target from the generated package configuration:

Example

CMakeLists.txt
cmake_minimum_required(VERSION 3.1)
 project(ExampleProject LANGUAGES CXX)
 
 find_package(nlohmann_json 3.11.3 REQUIRED)
@@ -46,4 +46,4 @@
     GIT_REPOSITORY https://github.com/nlohmann/json
     GIT_TAG v3.11.3
 )
-

However, the repository https://github.com/nlohmann/json download size is quite large.

CMake Options

JSON_BuildTests

Build the unit tests when BUILD_TESTING is enabled. This option is ON by default if the library's CMake project is the top project. That is, when integrating the library as described above, the test suite is not built unless explicitly switched on with this option.

JSON_CI

Enable CI build targets. The exact targets are used during the several CI steps and are subject to change without notice. This option is OFF by default.

JSON_Diagnostics

Enable extended diagnostic messages by defining macro JSON_DIAGNOSTICS. This option is OFF by default.

JSON_Diagnostic_Positions

Enable position diagnostics by defining macro JSON_DIAGNOSTIC_POSITIONS. This option is OFF by default.

JSON_DisableEnumSerialization

Disable default enum serialization by defining the macro JSON_DISABLE_ENUM_SERIALIZATION. This option is OFF by default.

JSON_FastTests

Skip expensive/slow test suites. This option is OFF by default. Depends on JSON_BuildTests.

JSON_GlobalUDLs

Place user-defined string literals in the global namespace by defining the macro JSON_USE_GLOBAL_UDLS. This option is OFF by default.

JSON_ImplicitConversions

Enable implicit conversions by defining macro JSON_USE_IMPLICIT_CONVERSIONS. This option is ON by default.

JSON_Install

Install CMake targets during install step. This option is ON by default if the library's CMake project is the top project.

JSON_LegacyDiscardedValueComparison

Enable the (incorrect) legacy comparison behavior of discarded JSON values by defining macro JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON. This option is OFF by default.

JSON_MultipleHeaders

Use non-amalgamated version of the library. This option is OFF by default.

JSON_SystemInclude

Treat the library headers like system headers (i.e., adding SYSTEM to the target_include_directories call) to checks for this library by tools like Clang-Tidy. This option is OFF by default.

JSON_Valgrind

Execute test suite with Valgrind. This option is OFF by default. Depends on JSON_BuildTests.

\ No newline at end of file +

However, the repository https://github.com/nlohmann/json download size is quite large.

CMake Options

JSON_BuildTests

Build the unit tests when BUILD_TESTING is enabled. This option is ON by default if the library's CMake project is the top project. That is, when integrating the library as described above, the test suite is not built unless explicitly switched on with this option.

JSON_CI

Enable CI build targets. The exact targets are used during the several CI steps and are subject to change without notice. This option is OFF by default.

JSON_Diagnostics

Enable extended diagnostic messages by defining macro JSON_DIAGNOSTICS. This option is OFF by default.

JSON_Diagnostic_Positions

Enable position diagnostics by defining macro JSON_DIAGNOSTIC_POSITIONS. This option is OFF by default.

JSON_DisableEnumSerialization

Disable default enum serialization by defining the macro JSON_DISABLE_ENUM_SERIALIZATION. This option is OFF by default.

JSON_FastTests

Skip expensive/slow test suites. This option is OFF by default. Depends on JSON_BuildTests.

JSON_GlobalUDLs

Place user-defined string literals in the global namespace by defining the macro JSON_USE_GLOBAL_UDLS. This option is OFF by default.

JSON_ImplicitConversions

Enable implicit conversions by defining macro JSON_USE_IMPLICIT_CONVERSIONS. This option is ON by default.

JSON_Install

Install CMake targets during install step. This option is ON by default if the library's CMake project is the top project.

JSON_LegacyDiscardedValueComparison

Enable the (incorrect) legacy comparison behavior of discarded JSON values by defining macro JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON. This option is OFF by default.

JSON_MultipleHeaders

Use non-amalgamated version of the library. This option is OFF by default.

JSON_SystemInclude

Treat the library headers like system headers (i.e., adding SYSTEM to the target_include_directories call) to checks for this library by tools like Clang-Tidy. This option is OFF by default.

JSON_Valgrind

Execute test suite with Valgrind. This option is OFF by default. Depends on JSON_BuildTests.

\ No newline at end of file diff --git a/integration/index.html b/integration/index.html index a68aa4ae0..13be057dc 100644 --- a/integration/index.html +++ b/integration/index.html @@ -1,5 +1,5 @@ - Header only - JSON for Modern C++
Skip to content

Header only

json.hpp is the single required file in single_include/nlohmann or released here. You need to add

#include <nlohmann/json.hpp>
+ Header only - JSON for Modern C++      

Header only

json.hpp is the single required file in single_include/nlohmann or released here. You need to add

#include <nlohmann/json.hpp>
 
 // for convenience
 using json = nlohmann::json;
-

to the files you want to process JSON and set the necessary switches to enable C++11 (e.g., -std=c++11 for GCC and Clang).

You can further use file single_include/nlohmann/json_fwd.hpp for forward declarations.

\ No newline at end of file +

to the files you want to process JSON and set the necessary switches to enable C++11 (e.g., -std=c++11 for GCC and Clang).

You can further use file single_include/nlohmann/json_fwd.hpp for forward declarations.

\ No newline at end of file diff --git a/integration/migration_guide/index.html b/integration/migration_guide/index.html index c15e573b7..c099e8474 100644 --- a/integration/migration_guide/index.html +++ b/integration/migration_guide/index.html @@ -1,4 +1,4 @@ - Migration Guide - JSON for Modern C++
Skip to content

Migration Guide

This page collects some guidelines on how to future-proof your code for future versions of this library.

Replace deprecated functions

The following functions have been deprecated and will be removed in the next major version (i.e., 4.0.0). All deprecations are annotated with HEDLEY_DEPRECATED_FOR to report which function to use instead.

Parsing

\ No newline at end of file diff --git a/integration/package_managers/index.html b/integration/package_managers/index.html index 021e1c047..a88e035bd 100644 --- a/integration/package_managers/index.html +++ b/integration/package_managers/index.html @@ -1,4 +1,4 @@ - Package Managers - JSON for Modern C++
Skip to content

Package Managers

Homebrew Homebrew nlohmann-jsonMeson Meson nlohmann_jsonBazel Bazel nlohmann_json
Conan Conan nlohmann_jsonSpack Spack nlohmann-jsonHunter nlohmann_json
vcpkg vcpkg nlohmann-jsoncget nlohmann/jsonSwift Package Manager Swift Package Manager nlohmann/json
Nuget NuGet nlohmann.jsonConda Conda nlohmann_jsonMacPorts MacPorts nlohmann-json
cpm.cmake CPM.cmake gh:nlohmann/json xmake xmake nlohmann_json

Running example

Throughout this page, we will describe how to compile the example file example.cpp below.

#include <nlohmann/json.hpp>
+ Package Managers - JSON for Modern C++      

Package Managers

Homebrew Homebrew nlohmann-jsonMeson Meson nlohmann_jsonBazel Bazel nlohmann_json
Conan Conan nlohmann_jsonSpack Spack nlohmann-jsonHunter nlohmann_json
vcpkg vcpkg nlohmann-jsoncget nlohmann/jsonSwift Package Manager Swift Package Manager nlohmann/json
Nuget NuGet nlohmann.jsonConda Conda nlohmann_jsonMacPorts MacPorts nlohmann-json
cpm.cmake CPM.cmake gh:nlohmann/json xmake xmake nlohmann_json

Running example

Throughout this page, we will describe how to compile the example file example.cpp below.

#include <nlohmann/json.hpp>
 #include <iostream>
 #include <iomanip>
 
@@ -237,7 +237,7 @@ cmake --build build
         </ClCompile>
     </ItemDefinitionGroup>
 </Project>
-

For libraries with binary files, we will need to add .lib files to linker inputs and add settings to copy .dll and other redistributable files to output directory, if needed.

There are other changes to the makefile as well:

  • Lines 165-167 add the packages.config as one of project files (so it is shown in Solution Explorer tree view). It is added as None (no build action) and removing it wouldn’t affect build.

  • Lines 172-177 check to ensure the required packages are present. This will display a build error if package directory is empty (for example when NuGet cannot restore packages because Internet connection is down). Again, if you omit this section, the only change in build would be a more cryptic error message if build fails.

Note

Changes to .vcxproj makefile should also be added to project source code repository.

As you can see, the mechanism NuGet uses to modify project settings is through MSBuild makefiles, so using NuGet with other build systems and compilers (like CMake) as a dependency manager is either impossible or more problematic than useful.

Please refer to this extensive description for more information.

Conda

Summary

package: nlohmann_json

If you are using conda, you can use the package nlohmann_json from conda-forge executing

conda install -c conda-forge nlohmann_json
+

For libraries with binary files, we will need to add .lib files to linker inputs and add settings to copy .dll and other redistributable files to output directory, if needed.

There are other changes to the makefile as well:

  • Lines 165-167 add the packages.config as one of project files (so it is shown in Solution Explorer tree view). It is added as None (no build action) and removing it wouldn’t affect build.

  • Lines 172-177 check to ensure the required packages are present. This will display a build error if package directory is empty (for example when NuGet cannot restore packages because Internet connection is down). Again, if you omit this section, the only change in build would be a more cryptic error message if build fails.

Note

Changes to .vcxproj makefile should also be added to project source code repository.

As you can see, the mechanism NuGet uses to modify project settings is through MSBuild makefiles, so using NuGet with other build systems and compilers (like CMake) as a dependency manager is either impossible or more problematic than useful.

Please refer to this extensive description for more information.

Conda

Summary

package: nlohmann_json

If you are using conda, you can use the package nlohmann_json from conda-forge executing

conda install -c conda-forge nlohmann_json
 
Example
  1. Create the following file:

    example.cpp
    #include <nlohmann/json.hpp>
     #include <iostream>
     #include <iomanip>
    @@ -330,4 +330,4 @@ cmake --build build
         set_languages("cxx11")
     
  2. Build

    xmake
     
  3. Run

    xmake run
    -

Other package managers

The library is also contained in many other package repositories: Packaging status

Package version overview

Packaging status


Buckaroo

If you are using Buckaroo, you can install this library's module with buckaroo add github.com/buckaroo-pm/nlohmann-json. There is a demo repo here.

Warning

The module is outdated as the respective repository has not been updated in years.

CocoaPods

If you are using CocoaPods, you can use the library by adding pod "nlohmann_json", '~>3.1.2' to your podfile (see an example). Please file issues here.

Warning

The module is outdated as the respective pod has not been updated in years.

\ No newline at end of file +

Other package managers

The library is also contained in many other package repositories: Packaging status

Package version overview

Packaging status


Buckaroo

If you are using Buckaroo, you can install this library's module with buckaroo add github.com/buckaroo-pm/nlohmann-json. There is a demo repo here.

Warning

The module is outdated as the respective repository has not been updated in years.

CocoaPods

If you are using CocoaPods, you can use the library by adding pod "nlohmann_json", '~>3.1.2' to your podfile (see an example). Please file issues here.

Warning

The module is outdated as the respective pod has not been updated in years.

\ No newline at end of file diff --git a/integration/pkg-config/index.html b/integration/pkg-config/index.html index 8f63c39f4..70a564c11 100644 --- a/integration/pkg-config/index.html +++ b/integration/pkg-config/index.html @@ -1,3 +1,3 @@ - Pkg-config - JSON for Modern C++
Skip to content

Pkg-config

If you are using bare Makefiles, you can use pkg-config to generate the include flags that point to where the library is installed:

pkg-config nlohmann_json --cflags
+ Pkg-config - JSON for Modern C++      

Pkg-config

If you are using bare Makefiles, you can use pkg-config to generate the include flags that point to where the library is installed:

pkg-config nlohmann_json --cflags
 

Users of the Meson build system will also be able to use a system-wide library, which will be found by pkg-config:

json = dependency('nlohmann_json', required: true)
-
\ No newline at end of file +
\ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 1b7ea3d0d..fead3fbb0 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,942 +2,942 @@ https://json.nlohmann.me/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/operator_gtgt/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/operator_literal_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/operator_literal_json_pointer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/operator_ltlt/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/ordered_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/ordered_map/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/adl_serializer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/adl_serializer/from_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/adl_serializer/to_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/accept/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/array/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/array_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/at/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/back/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/basic_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/begin/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/binary/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/binary_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/boolean_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/cbegin/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/cbor_tag_handler_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/cend/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/clear/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/contains/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/count/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/crbegin/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/crend/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/default_object_comparator_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/diff/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/dump/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/emplace/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/emplace_back/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/empty/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/end/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/end_pos/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/erase/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/error_handler_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/exception/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/find/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/flatten/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/from_bjdata/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/from_bson/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/from_cbor/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/from_msgpack/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/from_ubjson/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/front/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/get/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/get_allocator/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/get_binary/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/get_ptr/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/get_ref/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/get_to/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/input_format_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/insert/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/invalid_iterator/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_array/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_binary/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_boolean/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_discarded/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_null/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_number/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_number_float/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_number_integer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_number_unsigned/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_object/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_primitive/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_string/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/is_structured/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/items/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/json_base_class_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/json_serializer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/max_size/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/merge_patch/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/meta/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/number_float_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/number_integer_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/number_unsigned_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/object/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/object_comparator_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/object_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator%2B%3D/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator%3D/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator%5B%5D/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_ValueType/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_eq/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_ge/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_gt/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_le/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_lt/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_ne/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_spaceship/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/operator_value_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/other_error/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/out_of_range/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/parse/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/parse_error/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/parse_event_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/parser_callback_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/patch/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/patch_inplace/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/push_back/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/rbegin/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/rend/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/sax_parse/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/size/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/start_pos/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/std_hash/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/std_swap/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/string_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/swap/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/to_bjdata/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/to_bson/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/to_cbor/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/to_msgpack/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/to_string/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/to_ubjson/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/type/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/type_error/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/type_name/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/unflatten/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/update/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/value/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/value_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/basic_json/~basic_json/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/byte_container_with_subtype/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/byte_container_with_subtype/subtype/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/back/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/empty/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/json_pointer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/operator_eq/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/operator_ne/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/operator_slash/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/operator_slasheq/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/operator_string_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/parent_pointer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/pop_back/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/push_back/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/string_t/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_pointer/to_string/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/binary/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/boolean/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/end_array/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/end_object/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/key/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/null/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/number_float/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/number_integer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/number_unsigned/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/parse_error/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/start_array/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/start_object/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/json_sax/string/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_assert/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_diagnostic_positions/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_diagnostics/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_disable_enum_serialization/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_has_cpp_11/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_has_filesystem/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_has_ranges/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_has_static_rtti/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_has_three_way_comparison/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_no_io/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_noexception/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_skip_library_version_check/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_skip_unsupported_compiler_check/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_throw_user/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_use_global_udls/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_use_implicit_conversions/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/json_use_legacy_discarded_value_comparison/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_json_namespace/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_json_namespace_begin/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_json_namespace_no_version/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_json_serialize_enum/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/api/macros/nlohmann_json_version_major/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/community/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/community/code_of_conduct/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/community/contribution_guidelines/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/community/governance/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/community/quality_assurance/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/community/security_policy/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/arbitrary_types/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/assertions/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_values/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/comments/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/enum_conversion/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/iterators/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/json_patch/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/json_pointer/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/macros/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/merge_patch/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/namespace/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/object_order/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_formats/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_formats/bjdata/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_formats/bson/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_formats/cbor/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_formats/messagepack/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/binary_formats/ubjson/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/element_access/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/element_access/checked_access/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/element_access/default_value/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/element_access/unchecked_access/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/parsing/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/parsing/json_lines/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/parsing/parse_exceptions/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/parsing/parser_callbacks/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/parsing/sax_interface/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/types/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/features/types/number_handling/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/architecture/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/customers/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/design_goals/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/exceptions/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/faq/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/license/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/releases/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/home/sponsors/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/integration/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/integration/cmake/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/integration/migration_guide/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/integration/package_managers/ - 2025-02-15 + 2025-02-21 https://json.nlohmann.me/integration/pkg-config/ - 2025-02-15 + 2025-02-21 \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index b38b44fe0a93ad9caa2449a5cc4185c3b7de9ed6..07ffa2de444a40409d01f9dc94860412fed804ff 100644 GIT binary patch delta 1631 zcmV-l2B7)94ZRJ2ABzYG0K&It0{?SqbY*Q}a4vXlYyj1r&rT#a5XSHO6bNaLFhI0Y z60xkbit+@TTrIb|y4&Eky)HK}Ipo=6dz$&fhK-^~{v0mD4A9@NZFjk#N-fW(po-SEO znx*GU7sd^%DZSy%`r+p4@~88=cW3DofhjhUzogdS>%Ca|tDQIc*AJu#NmG}_cjA;E=7||gh zI>}mrg{4yDBTzpCxdqD$iE&$(WsH~+RCs+>m!GM=bRyFkq8Pr2vnDR zpD0H$N!uF=(6%7k1J%<|2tavfqtup>1dB!Xen3Be3IRI)dK%0Alqe$5OMpI;NnCgbw8<1CBS&Be$^JCp8qjkN6gARY zA2f0#4o1dE$lK4klJ35jQKBKBL0dt{UNabB=Fvmvg+j4(_vqe0`m7^i#f3EKFS3(} z#XzTj5;B92;6?~EU;(1T>1*qkCJ*G1lr$z+jbKrr;aQPSaS6DF$1gmA3wY3Vb=a~x zmd^rgps>jjjxt1S6%)r^Op+%o0Y6EPB*^((q(R2se{}Hbp^N~nR!IQZ%Ao`RuNz7X z=(UZ6fG%8$(1b@;M|;eL!O9uf42y+-msKu4*+gIylsFnJkDL_$#BBuJMiT3;pA@n^ z={N~qI)q{P4$1$6vh3YzkSjU84N@`17O5aaz@sNlqyZ^{6Me)kpA&#qIs&&A^!FH+ zn!sRFKYsrXNh6&D3hGZ_ybL+%+`yybofl|3hRU~|K(sI{P+|72OiezcWFZw5=LdC2 zvH4y;?^i_>{ht6ps-N}*50ec9T>{tFlWYVWe@SlFl5)+^@oJsW4yunjj^vnvAG8-n zcOf65w;tgv)I`-o-*2Fj>$Q0ALZrS77@ZG~L6fC1?4HEJ)g9Agh$JsY<2q@?(i;Yo z=-C^sblxap*8zk^GBirHJ?xiW>wM8>=jCJ3)1WP-m!Kc>9;5mT7H<%h)$|m3g@xn6Vd2WH|WzwDHebpd8S;Kj; zy6Sq}K~uS&@}`3{Y4l6gsQ#ECSrpwZ*##5hqI)vQ;4p+`bZHz|X{#EPgZ$SeJrr@9 ze<$VGUOx~-LG=v|Z-Ow!1ir$kyxHL`jP!`G9I5iQhqq{|?>sonk%sd8Eb@QdVQzq+f8+$I zZwKh*4F1|x@o(`g7T-j9A-nGS={M5Fy{H}GeM7OX=)a`?@hpdZ-cXjj!?t*S1IQ17 z#d|y9wcweJRkY8&{ z8m-83^??=AL@1f6w=nzEt#w2AIZ`ecYS(}qtEyQ(5J-F0>vy{}E{GzB1}Q=i>1XK$ d*8Toryim>#`aet}<%KEU{RL$y7%kj+006SQA5s7S delta 1631 zcmV-l2B7)94ZRJ2ABzYG0NJl+0{?SqbY*Q}a4vXlYyj1r!A>MM5Qgvj6bNaLFhGQq zL@X<ugeWg4te(2o@Qo%uu&Arzr$si0s8;ic9*NlWpnfSX*MSh z6j(d^>Gbma;`D^9a=o_Wr_F3)IH%l-~@g)6!vgJ>wQ;h!S&F1m(@tk#} zS$aNqVcf8q(i`5aA8szre>%PWaFV|A1$N(+uN&jkZN3Vp%iOWE=hnDsme!unw7J>j zA0Pj=Fpx**0lMwGTmofM=I z$ooHL5Z-Bjo8H1$qN&~&p{GDSqzhK*{Fv5Nmc0>7K})0msNUPJ#E0N!MC-r8hza2+;A@(;ycUh3oD}MWNj6= z20E30kQsagH$tER3lJSnUt7OKF}N_xh;$TE1Wf^|{~(R-MOoQ`K9`yWIK7<+(1sx+ z?2>#?hF-Ihp{E{7VHab-0CPv70R%A^hg|zOfaEprv5huaEbGyN$LKEm1x4^d&pPS{ zf>Lk{+Ky<1Ma3mRheV_qn13miDd{~4l`hYJNYAFAz$zz>KxX+QI3WNDD2yb$jA}wc zATuGy^B8hezMRGyAbFm}kSOR$tf?iW6$VML*7$wA`ttFIUmDSG6J+(B>`Y7hY|q1ZYVLJ z*ESLYx^O8%6CPO|?J*YyD`#LcEEZmWR=N0O6M;=o;%Klua#H*gw-Im~NvykmQponG z<0N?L5QgD9B>xY}vUjUNuH^JKNW~Oeq=FCukDhoT4M-8Z&`0d@c>&N$N8r|i{vN|p z6Bumj$M4@EX{2*NLH!FDFGEf`H}L3q=LOo1q4KRSAX*p}s4#n1rY4_IvXF`u^Mg91 z*nBUa_p2g`{$Bt_VvlWYVWe^GANl5)+^@oJsW4yunjj^vnv@3j|3 zcOf65w;tgv)I`-o-#1Xn^;*1lAyQukjLwJ0pvlr0c8_A=>W=9#M3NVyah)_`=?#NP z^z4mRI&T!Q>i|L{85*V99`;MGb-rk`^Zc>sY0#F^OVAH_k5T;vi+701YI=&i!ou}; zf3ALy$)=udg==TMdDB6fH2S4#RDaBnEQ;=y?1G7L(LI@Da2Ucex-<@~v{entLH^s49*Vfl z@%|EE6ijLf8N<8eQq&xn1Ic_u0dHjJe{?L)aGrM3fUmEEYl`g)#r@t7b0c{q@b z5bcssIry;%gy$olAossp`>VX==9PN&73jTw^=#`w8FCcGULN7h?#0)g{pEkj01e*m z&^c~^p!x=fcR?6q0$*WN-t6!mMtVe8j#PQu!+SK^|5 zqZL`MKCnWX2qjbX7G|HiwQdMsIm+ci?HZ6{RW-|d0%^~B{ce}W1ySVCAVmlw{Vct} dy5HZAXUf?@|A$GWyfDSvzW|c=8R*=30070xD?R`K