Compare commits

..
Author SHA1 Message Date
Niels Lohmann b38c056204 json_view benchmarks: compare fairly and state what each row means
- bench_view: add "(editable)" rows for json_editable_document and a
  parse+dump workload, so the cost of lazy float conversion shows next to the
  parse row (the traverse workload already includes the parse). Check that
  all engines' dumps agree where outputs are comparable.
- compare.py: add --aligned, which also builds and runs with aligned code and
  reports both tables, so code-layout artifacts become visible. Off by
  default; the default output is unchanged. Not run end to end yet.
- README: say which engines are like-for-like peers (yyjson, simdjson DOM) and
  which are mutable reference points (Boost.JSON, json::parse, the editable
  json_view); explain the lazy float conversion and the eager prototype that
  was measured and dropped.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-25 10:54:04 +01:00
566 changed files with 4982 additions and 7521 deletions

No files matched your search

+7 -36
View File
@@ -1,33 +1,3 @@
# Style or vendor rule sets that do not fit a header-only library:
# altera-*, fuchsia-*, llvmlibc-*, android-cloexec-fopen, boost-use-ranges, llvm-header-guard,
# llvm-include-order, llvm-prefer-static-over-anonymous-namespace, llvm-use-ranges,
# misc-use-anonymous-namespace, google-runtime-float, google-runtime-int, hicpp-signed-bitwise,
# bugprone-signed-bitwise, hicpp-explicit-conversions, google-explicit-constructor,
# cppcoreguidelines-explicit-constructor, misc-explicit-constructor (implicit conversions are the
# API), readability-trailing-comma,
# hicpp-avoid-goto / cppcoreguidelines-avoid-goto, hicpp-no-array-decay,
# hicpp-uppercase-literal-suffix, readability-uppercase-literal-suffix, modernize-use-trailing-return-type.
# Constructs the library needs on purpose (the library supports C++11 and legacy compilers):
# cppcoreguidelines-macro-usage, cppcoreguidelines-avoid-do-while (macros),
# cppcoreguidelines-pro-bounds-*, cppcoreguidelines-pro-type-reinterpret-cast,
# cppcoreguidelines-pro-type-union-access (parsers, serializers, basic_json's value union),
# cppcoreguidelines-avoid-const-or-ref-data-members, cppcoreguidelines-rvalue-reference-param-not-moved,
# cppcoreguidelines-avoid-non-const-global-variables, misc-non-private-member-variables-in-classes,
# misc-no-recursion (value walks are recursive, bounded by detail::recursion_depth_limit()),
# modernize-type-traits, modernize-use-constraints, modernize-use-ranges, modernize-use-std-numbers,
# modernize-use-designated-initializers, modernize-use-nodiscard, modernize-concat-nested-namespaces,
# readability-redundant-typename, readability-redundant-parentheses,
# readability-redundant-access-specifiers, readability-simplify-boolean-expr,
# readability-use-concise-preprocessor-directives, modernize-use-string-view,
# modernize-use-integer-sign-comparison (needs std::cmp_less; the flagged
# static_cast<std::size_t>(end - pos) < n comparisons are deliberate)
# (all need a newer standard or compiler than C++11, or would change macro-generated or
# deliberately explicit code).
# Too noisy to be useful (numeric parsing/formatting code, doctest, tests):
# bugprone-easily-swappable-parameters, cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers,
# readability-identifier-length, readability-function-cognitive-complexity, performance-enum-size,
# concurrency-mt-unsafe, misc-confusable-identifiers, misc-include-cleaner (run on its own for
# the consumer headers in cmake/ci.cmake).
# portability-avoid-pragma-once: kept disabled on purpose. #pragma once is accepted # portability-avoid-pragma-once: kept disabled on purpose. #pragma once is accepted
# by every supported compiler, and tools/amalgamate/amalgamate.py strips it from # by every supported compiler, and tools/amalgamate/amalgamate.py strips it from
# single_include, so there is nothing left to fix here. # single_include, so there is nothing left to fix here.
@@ -40,14 +10,14 @@ Checks: '*,
-android-cloexec-fopen, -android-cloexec-fopen,
-boost-use-ranges, -boost-use-ranges,
-bugprone-easily-swappable-parameters, -bugprone-easily-swappable-parameters,
-bugprone-signed-bitwise, -cert-err58-cpp,
-clang-analyzer-webkit.NoUncountedMemberChecker,
-concurrency-mt-unsafe, -concurrency-mt-unsafe,
-cppcoreguidelines-avoid-const-or-ref-data-members, -cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-do-while, -cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-explicit-constructor,
-cppcoreguidelines-macro-usage, -cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-avoid-unchecked-container-access, -cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
@@ -56,15 +26,19 @@ Checks: '*,
-cppcoreguidelines-pro-type-reinterpret-cast, -cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access, -cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-rvalue-reference-param-not-moved, -cppcoreguidelines-rvalue-reference-param-not-moved,
-cppcoreguidelines-virtual-class-destructor,
-fuchsia-default-arguments-calls, -fuchsia-default-arguments-calls,
-fuchsia-default-arguments-declarations, -fuchsia-default-arguments-declarations,
-fuchsia-overloaded-operator, -fuchsia-overloaded-operator,
-google-explicit-constructor, -google-explicit-constructor,
-google-readability-function-size,
-google-runtime-float, -google-runtime-float,
-google-runtime-int, -google-runtime-int,
-hicpp-avoid-goto, -hicpp-avoid-goto,
-hicpp-explicit-conversions, -hicpp-explicit-conversions,
-hicpp-function-size,
-hicpp-no-array-decay, -hicpp-no-array-decay,
-hicpp-no-assembler,
-hicpp-signed-bitwise, -hicpp-signed-bitwise,
-hicpp-uppercase-literal-suffix, -hicpp-uppercase-literal-suffix,
-llvm-header-guard, -llvm-header-guard,
@@ -74,7 +48,6 @@ Checks: '*,
-llvmlibc-*, -llvmlibc-*,
-misc-use-anonymous-namespace, -misc-use-anonymous-namespace,
-misc-confusable-identifiers, -misc-confusable-identifiers,
-misc-explicit-constructor,
-misc-include-cleaner, -misc-include-cleaner,
-misc-no-recursion, -misc-no-recursion,
-misc-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes,
@@ -82,22 +55,20 @@ Checks: '*,
-modernize-type-traits, -modernize-type-traits,
-modernize-use-constraints, -modernize-use-constraints,
-modernize-use-designated-initializers, -modernize-use-designated-initializers,
-modernize-use-integer-sign-comparison,
-modernize-use-nodiscard, -modernize-use-nodiscard,
-modernize-use-ranges, -modernize-use-ranges,
-modernize-use-string-view,
-modernize-use-std-numbers, -modernize-use-std-numbers,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-performance-enum-size, -performance-enum-size,
-portability-avoid-pragma-once, -portability-avoid-pragma-once,
-readability-function-cognitive-complexity, -readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length, -readability-identifier-length,
-readability-magic-numbers, -readability-magic-numbers,
-readability-redundant-access-specifiers, -readability-redundant-access-specifiers,
-readability-redundant-parentheses, -readability-redundant-parentheses,
-readability-redundant-typename, -readability-redundant-typename,
-readability-simplify-boolean-expr, -readability-simplify-boolean-expr,
-readability-trailing-comma,
-readability-uppercase-literal-suffix, -readability-uppercase-literal-suffix,
-readability-use-concise-preprocessor-directives' -readability-use-concise-preprocessor-directives'
+1 -2
View File
@@ -43,8 +43,7 @@ jobs:
- name: flawfinder_scan - name: flawfinder_scan
uses: david-a-wheeler/flawfinder@c4216b74cf2639ffa98503768bd6e4299b5440c9 # v2.0.20 uses: david-a-wheeler/flawfinder@c4216b74cf2639ffa98503768bd6e4299b5440c9 # v2.0.20
with: with:
# single_include/ is omitted: it is generated from include/ and would report every finding twice arguments: '--sarif ./'
arguments: '--sarif ./cmake ./docs ./include ./src ./tests ./tools'
output: 'flawfinder_results.sarif' output: 'flawfinder_results.sarif'
- name: Upload analysis results to GitHub Security tab - name: Upload analysis results to GitHub Security tab
+4 -4
View File
@@ -151,7 +151,7 @@ The `json` class provides an API for manipulating a JSON value. To create a `jso
```cpp ```cpp
#include <fstream> #include <fstream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
// ... // ...
@@ -164,7 +164,7 @@ If using modules (enabled with `NLOHMANN_JSON_BUILD_MODULES`), this example beco
import std; import std;
import nlohmann.json; import nlohmann.json;
using nlohmann::json; using json = nlohmann::json;
// ... // ...
@@ -842,7 +842,7 @@ assert(p == p2);
To make this work with one of your types, you only need to provide two functions: To make this work with one of your types, you only need to provide two functions:
```cpp ```cpp
using nlohmann::json; using json = nlohmann::json;
namespace ns { namespace ns {
void to_json(json& j, const person& p) { void to_json(json& j, const person& p) {
@@ -1257,7 +1257,7 @@ See the page [quality assurance](https://json.nlohmann.me/community/quality_assu
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
// for convenience // for convenience
using nlohmann::json; 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). 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).
@@ -30,14 +30,6 @@ struct adl_serializer {
- [**from_json**](from_json.md) - convert a JSON value to any value type - [**from_json**](from_json.md) - convert a JSON value to any value type
- [**to_json**](to_json.md) - convert any value type to a JSON value - [**to_json**](to_json.md) - convert any value type to a JSON value
## See also
- [Arbitrary type conversions](../../features/arbitrary_types.md) - how to make your types convertible
- [**get**](../basic_json/get.md) / [**get_to**](../basic_json/get_to.md) - convert a JSON value to a C++ type
- [**basic_json**](../basic_json/basic_json.md) - construct a JSON value from a C++ value
- [**NLOHMANN_DEFINE_TYPE_INTRUSIVE**](../macros/nlohmann_define_type_intrusive.md) - generate the conversion functions for a type
- [Specializing enum conversion](../../features/enum_conversion.md)
## Version history ## Version history
- Added in version 2.1.0. - Added in version 2.1.0.
+1 -25
View File
@@ -23,9 +23,6 @@ Checks whether the input is valid JSON.
respectively as UTF-8, UTF-16, and UTF-32. If `SentinelType` differs from `IteratorType`, it must be comparable to respectively as UTF-8, UTF-16, and UTF-32. If `SentinelType` differs from `IteratorType`, it must be comparable to
the iterator type with `operator!=`. the iterator type with `operator!=`.
Ill-formed UTF-16 and UTF-32 sequences are rejected: a lone surrogate, a high surrogate that is not followed by its
low surrogate, and a code point above `U+10FFFF` all make this function return `false`.
Unlike the [`parse()`](parse.md) function, this function neither throws an exception in case of invalid JSON input Unlike the [`parse()`](parse.md) function, this function neither throws an exception in case of invalid JSON input
(i.e., a parse error) nor creates diagnostic information. (i.e., a parse error) nor creates diagnostic information.
@@ -38,12 +35,9 @@ Unlike the [`parse()`](parse.md) function, this function neither throws an excep
- a `#!c FILE` pointer (throws if null) - a `#!c FILE` pointer (throws if null)
- a C-style array of characters - a C-style array of characters
- a pointer to a null-terminated string of single byte characters (throws if null) - a pointer to a null-terminated string of single byte characters (throws if null)
- a `std::string` or a `std::string_view` (C++17) - a `std::string`
- a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators - a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators
(as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`) (as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`)
- wide characters (`wchar_t`, `char16_t`, `char32_t`), which are converted to UTF-8: a wide string object
(`std::wstring`, `std::u16string`, `std::u32string`) or an array (e.g. a wide string literal); a pointer to a
null-terminated wide string (e.g. `std::u16string::c_str()`) is not supported
`IteratorType` `IteratorType`
: a compatible iterator type, for instance. : a compatible iterator type, for instance.
@@ -131,21 +125,6 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
--8<-- "examples/accept__iterator_pair.output" --8<-- "examples/accept__iterator_pair.output"
``` ```
??? example "Example: (3) reading from UTF-16 strings"
The encoding is deduced from the character type of the input. String literals like `u"..."`, `U"..."`, and
`L"..."` work as well.
```cpp
--8<-- "examples/accept__wide_string.cpp"
```
Output:
```json
--8<-- "examples/accept__wide_string.output"
```
## See also ## See also
- [parse](parse.md) - deserialize from a compatible input - [parse](parse.md) - deserialize from a compatible input
@@ -172,9 +151,6 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
([`JSON_DISABLE_STREAM_BULK_SCAN`](../macros/json_disable_stream_bulk_scan.md)). ([`JSON_DISABLE_STREAM_BULK_SCAN`](../macros/json_disable_stream_bulk_scan.md)).
- Parsing from a `FILE*` locks the file once instead of once per character in version 3.13.0 - Parsing from a `FILE*` locks the file once instead of once per character in version 3.13.0
([`JSON_DISABLE_UNLOCKED_FILE_IO`](../macros/json_disable_unlocked_file_io.md)). ([`JSON_DISABLE_UNLOCKED_FILE_IO`](../macros/json_disable_unlocked_file_io.md)).
- Ill-formed UTF-16 and UTF-32 input (a lone surrogate, a high surrogate that is not followed by its low surrogate, or
a code point above `U+10FFFF`) is rejected in version 3.13.0; before that, some such sequences were accepted or
ended the input silently.
!!! warning "Deprecation" !!! warning "Deprecation"
+3 -2
View File
@@ -239,8 +239,9 @@ Strong exception safety: if an exception occurs, the original value stays intact
1. Added in version 1.0.0. 1. Added in version 1.0.0.
2. Added in version 1.0.0. 2. Added in version 1.0.0.
3. Added in version 3.11.0. Support for keys convertible to `std::string_view` added in version 3.13.0, consistently 3. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
across the lookup functions. already supported by [`operator[]`](operator[].md), [`value`](value.md), [`find`](find.md), and other lookup
functions.
4. Added in version 2.0.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of 4. Added in version 2.0.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is not [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is not
a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones. a digit (e.g., `/x`) in version 3.13.0, as it already did for longer ones.
+1 -1
View File
@@ -63,4 +63,4 @@ Constant.
## Version history ## Version history
- Added in version 1.0.0. - Added in version 1.0.0.
- Binary values are supported since version 3.8.0. - Adjusted code to return reference to binary values in version 3.8.0.
@@ -482,15 +482,15 @@ basic_json(basic_json&& other) noexcept;
## Version history ## Version history
1. Added in version 1.0.0. 1. Since version 1.0.0.
2. Added in version 1.0.0. 2. Since version 1.0.0.
3. Added in version 2.1.0. 3. Since version 2.1.0.
4. Added in version 3.1.2. Explicit for different string types if `JSON_USE_IMPLICIT_CONVERSIONS` is `0` since 4. Since version 3.2.0. Explicit for different string types if `JSON_USE_IMPLICIT_CONVERSIONS` is `0` since
version 3.13.0. version 3.13.0.
5. Added in version 1.0.0. 5. Since version 1.0.0.
6. Added in version 1.0.0. 6. Since version 1.0.0.
7. Added in version 1.0.0. Fixed in version 3.13.0 to also check the iterator range for binary values; before, a range 7. Since version 1.0.0. Fixed in version 3.13.0 to also check the iterator range for binary values; before, a range
that did not cover the whole value (such as `(end(), end())`) was accepted and the whole binary value was copied, that did not cover the whole value (such as `(end(), end())`) was accepted and the whole binary value was copied,
unlike the other primitive types. unlike the other primitive types.
8. Added in version 1.0.0. 8. Since version 1.0.0.
9. Added in version 1.0.0. 9. Since version 1.0.0.
+3 -2
View File
@@ -141,8 +141,9 @@ Logarithmic in the size of the JSON object.
## Version history ## Version history
1. Added in version 3.11.0. 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. Support for keys 2. Added in version 3.6.0. Extended template `KeyType` to support comparable types in version 3.11.0. Fixed in
convertible to `std::string_view` added in version 3.13.0, consistently across the lookup functions. version 3.13.0 to consistently accept `std::string_view`-convertible keys, as already supported by
[`operator[]`](operator[].md), [`at`](at.md), [`value`](value.md), and other lookup functions.
3. Added in version 3.7.0. 3. Added in version 3.7.0.
4. Deleted overloads for integral key types added in version 3.13.0 to reject such calls at compile time instead of 4. Deleted overloads for integral key types added in version 3.13.0 to reject such calls at compile time instead of
causing undefined behavior at runtime. causing undefined behavior at runtime.
+3 -2
View File
@@ -92,7 +92,8 @@ Logarithmic in the size of the JSON object.
## Version history ## Version history
1. Added in version 3.11.0. 1. Added in version 3.11.0.
2. Added in version 1.0.0. Changed to support comparable key types in version 3.11.0. Support for keys convertible to 2. Added in version 1.0.0. Changed parameter `key` type to `KeyType&&` in version 3.11.0. Fixed in version 3.13.0 to
`std::string_view` added in version 3.13.0, consistently across the lookup functions. consistently accept `std::string_view`-convertible keys, as already supported by [`operator[]`](operator[].md),
[`at`](at.md), [`value`](value.md), and other lookup functions.
3. Deleted overload for integral key types added in version 3.13.0 to reject such calls at compile time instead of 3. Deleted overload for integral key types added in version 3.13.0 to reject such calls at compile time instead of
causing undefined behavior at runtime. causing undefined behavior at runtime.
+1 -1
View File
@@ -69,6 +69,6 @@ Logarithmic in the size of the container, O(log(`size()`)).
## Version history ## Version history
- Added in version 2.0.8. - Since version 2.0.8.
- Fixed in version 3.13.0: for [`ordered_json`](../ordered_json.md), the value could previously only be passed as an - Fixed in version 3.13.0: for [`ordered_json`](../ordered_json.md), the value could previously only be passed as an
rvalue; it can now also be passed as an lvalue or a `#!cpp const` lvalue, matching the behavior of `json`. rvalue; it can now also be passed as an lvalue or a `#!cpp const` lvalue, matching the behavior of `json`.
@@ -67,5 +67,5 @@ Amortized constant.
## Version history ## Version history
- Added in version 2.0.8. - Since version 2.0.8.
- Returns reference since 3.7.0. - Returns reference since 3.7.0.
+3 -2
View File
@@ -213,6 +213,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
1. Added in version 1.0.0. Added support for binary types in version 3.8.0. 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. 2. Added in version 1.0.0. Added support for binary types in version 3.8.0.
3. Added in version 1.0.0. 3. Added in version 1.0.0.
4. Added in version 3.11.0. Support for keys convertible to `std::string_view` added in version 3.13.0, consistently 4. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
across the lookup functions. already supported by [`operator[]`](operator[].md), [`at`](at.md), [`value`](value.md), and other lookup
functions.
5. Added in version 1.0.0. 5. Added in version 1.0.0.
+1 -1
View File
@@ -84,4 +84,4 @@ constructor.
## Version history ## Version history
- Added in version 3.0.0. - Since version 3.0.0.
+3 -2
View File
@@ -99,7 +99,8 @@ Logarithmic in the size of the JSON object.
## Version history ## Version history
1. Added in version 3.11.0. 1. Added in version 3.11.0.
2. Added in version 1.0.0. Changed to support comparable types in version 3.11.0. Support for keys convertible to 2. Added in version 1.0.0. Changed to support comparable types in version 3.11.0. Fixed in version 3.13.0 to
`std::string_view` added in version 3.13.0, consistently across the lookup functions. consistently accept `std::string_view`-convertible keys, as already supported by [`operator[]`](operator[].md),
[`at`](at.md), [`value`](value.md), and other lookup functions.
3. Deleted overloads for integral key types added in version 3.13.0 to reject such calls at compile time instead of 3. Deleted overloads for integral key types added in version 3.13.0 to reject such calls at compile time instead of
causing undefined behavior at runtime. causing undefined behavior at runtime.
+1 -1
View File
@@ -57,4 +57,4 @@ Constant.
## Version history ## Version history
- Added in version 1.0.0. - Added in version 1.0.0.
- Binary values are supported since version 3.8.0. - Adjusted code to return reference to binary values in version 3.8.0.
+3 -3
View File
@@ -188,6 +188,6 @@ overload (3).
## Version history ## Version history
1. Added in version 2.1.0. 1. Since version 2.1.0.
2. Added in version 2.1.0. Extended to work with other specializations of `basic_json` in version 3.1.2. 2. Since version 2.1.0. Extended to work with other specializations of `basic_json` in version 3.2.0.
3. Added in version 1.0.0. 3. Since version 1.0.0.
+1 -1
View File
@@ -45,7 +45,7 @@ Constant.
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
+1 -1
View File
@@ -76,5 +76,5 @@ Depends on the `json_serializer<ValueType>::from_json()` implementation.
## Version history ## Version history
- Added in version 3.3.0. - Since version 3.3.0.
- Added a `static_assert` with a clear message for `const` arguments in version 3.13.0. - Added a `static_assert` with a clear message for `const` arguments in version 3.13.0.
-19
View File
@@ -44,22 +44,6 @@ are collected in [Template Parameter Requirements](../../features/types/template
- [**json**](../json.md) - default specialization - [**json**](../json.md) - default specialization
- [**ordered_json**](../ordered_json.md) - a specialization that maintains the insertion order of object keys - [**ordered_json**](../ordered_json.md) - a specialization that maintains the insertion order of object keys
## Documents and views
Besides `basic_json`, the library offers a second way to hold a parsed JSON text: a
[`basic_json_document`](../basic_json_document/index.md), which owns or borrows the text and holds a flat index of the
values in it, and a [`basic_json_view`](../basic_json_view/index.md), a read-only handle to one value of such a document.
Both are defined in the header `<nlohmann/json_view.hpp>`; see
[Zero-copy JSON views](../../features/json_view.md) for the concept and the trade-offs.
- [**json_document**](../json_document.md) / [**ordered_json_document**](../ordered_json_document.md) - read-only
documents of the `basic_json` specialization they belong to
- [**json_editable_document**](../json_editable_document.md) /
[**ordered_json_editable_document**](../ordered_json_editable_document.md) - documents that can be modified in place
- [**json_view**](../json_view.md) / [**ordered_json_view**](../ordered_json_view.md) - views of a document
- [**json_editable_view**](../json_editable_view.md) /
[**ordered_json_editable_view**](../ordered_json_editable_view.md) - views of an editable document
## Iterator invalidation ## Iterator invalidation
All operations that add values to an **array** ([`push_back`](push_back.md) , [`operator+=`](operator+=.md), All operations that add values to an **array** ([`push_back`](push_back.md) , [`operator+=`](operator+=.md),
@@ -359,9 +343,6 @@ Access to the JSON value
## See also ## See also
- [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc8259) - [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://tools.ietf.org/html/rfc8259)
- [basic_json_document](../basic_json_document/index.md) / [basic_json_view](../basic_json_view/index.md) - parse a JSON
text into a flat index and read it through a view
- [Zero-copy JSON views](../../features/json_view.md) - when to use a document and a view instead of a `basic_json`
## Version history ## Version history
@@ -75,4 +75,4 @@ classDiagram
## Version history ## Version history
- Added in version 3.0.0. - Since version 3.0.0.
+2 -2
View File
@@ -104,8 +104,8 @@ When iterating over an array, `key()` will return the index of the element as st
## Version history ## Version history
- Added in version 3.1.0 as the replacement of the static function `iterator_wrapper`, which was available since - Added `iterator_wrapper` in version 3.0.0.
version 1.0.0 and is deprecated since version 3.1.0. - Added `items` and deprecated `iterator_wrapper` in version 3.1.0.
- Added structured binding support in version 3.5.0. - Added structured binding support in version 3.5.0.
!!! warning "Deprecation" !!! warning "Deprecation"
@@ -51,4 +51,4 @@ deserializes. See [Template Parameter Requirements](../../features/types/templat
## Version history ## Version history
- Added in version 2.1.0. - Since version 2.0.0.
@@ -71,6 +71,6 @@ returned by `#!cpp (*this)[key]`); it is read as it was when `merge_patch()` was
## Version history ## Version history
- Added in version 3.1.0. - Added in version 3.0.0.
- Fixed use of freed or relocated memory when `apply_patch` is `#!cpp *this` or refers to a value contained in - Fixed use of freed or relocated memory when `apply_patch` is `#!cpp *this` or refers to a value contained in
`#!cpp *this`, in version 3.13.0. `#!cpp *this`, in version 3.13.0.
@@ -128,6 +128,6 @@ interpreted as `object_t::value_type` or `std::initializer_list<basic_json>`, se
## Version history ## Version history
1. Added in version 1.0.0. 1. Since version 1.0.0.
2. Added in version 1.0.0. 2. Since version 1.0.0.
3. Added in version 2.0.0. 3. Since version 2.0.0.
@@ -284,10 +284,10 @@ Strong exception safety: if an exception occurs, the original value stays intact
1. Added in version 1.0.0. Fixed in version 3.13.0 to throw `#!cpp std::length_error` instead of emptying the array and 1. Added in version 1.0.0. Fixed in version 3.13.0 to throw `#!cpp std::length_error` instead of emptying the array and
accessing it out of bounds when `idx` equals the maximum value of `size_type`. A missing index in the const version accessing it out of bounds when `idx` equals the maximum value of `size_type`. A missing index in the const version
is guarded by a runtime assertion since version 3.13.0. is guarded by a runtime assertion since version 3.13.0.
2. Added in version 1.0.0. Added overloads for `T* key` in version 1.1.0. The `T* key` overloads forward to 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)
overload 3 since version 3.11.0. in version 3.11.0.
3. Added in version 3.11.0. Support for keys convertible to `std::string_view` added in version 3.13.0, consistently 3. Added in version 3.11.0. Fixed in version 3.13.0 to consistently accept `std::string_view`-convertible keys, as
across the lookup functions. already supported by [`at`](at.md), [`value`](value.md), [`find`](find.md), and other lookup functions.
4. Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since 4. Added in version 2.0.0. A missing array index in the const version is guarded by a runtime assertion since
version 3.13.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of version 3.13.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) instead of
[`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is not [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) for a one-character array index that is not
@@ -89,6 +89,6 @@ Linear in the size of the JSON value.
## Version history ## Version history
- Added in version 1.0.0. - Since version 1.0.0.
- Macros `JSON_EXPLICIT`/[`JSON_USE_IMPLICIT_CONVERSIONS`](../macros/json_use_implicit_conversions.md) added - Macros `JSON_EXPLICIT`/[`JSON_USE_IMPLICIT_CONVERSIONS`](../macros/json_use_implicit_conversions.md) added
in version 3.9.0. in version 3.9.0.
@@ -75,4 +75,4 @@ classDiagram
## Version history ## Version history
- Added in version 3.0.0. - Since version 3.0.0.
@@ -76,4 +76,4 @@ classDiagram
## Version history ## Version history
- Added in version 3.0.0. - Since version 3.0.0.
+1 -34
View File
@@ -25,10 +25,6 @@ static basic_json parse(IteratorType first, SentinelType last,
respectively as UTF-8, UTF-16, and UTF-32. If `SentinelType` differs from `IteratorType`, it must be comparable to respectively as UTF-8, UTF-16, and UTF-32. If `SentinelType` differs from `IteratorType`, it must be comparable to
the iterator type with `operator!=`. the iterator type with `operator!=`.
Ill-formed UTF-16 and UTF-32 sequences are rejected: a lone surrogate, a high surrogate that is not followed by its
low surrogate, and a code point above `U+10FFFF` all yield a
[`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101).
## Template parameters ## Template parameters
`InputType` `InputType`
@@ -38,12 +34,9 @@ static basic_json parse(IteratorType first, SentinelType last,
- a `FILE` pointer (throws if null) - a `FILE` pointer (throws if null)
- a C-style array of characters - a C-style array of characters
- a pointer to a null-terminated string of single byte characters (throws if null) - a pointer to a null-terminated string of single byte characters (throws if null)
- a `std::string` or a `std::string_view` (C++17) - a `std::string`
- a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators - a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators
(as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`) (as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`)
- wide characters (`wchar_t`, `char16_t`, `char32_t`), which are converted to UTF-8: a wide string object
(`std::wstring`, `std::u16string`, `std::u32string`) or an array (e.g. a wide string literal); a pointer to a
null-terminated wide string (e.g. `std::u16string::c_str()`) is not supported
`IteratorType` `IteratorType`
: a compatible iterator type, for instance. : a compatible iterator type, for instance.
@@ -119,13 +112,6 @@ By default, a `'\0'` (NUL) byte anywhere in the input is treated as end of input
outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-bytes-in-the-input) for details and the outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-bytes-in-the-input) for details and the
[`JSON_STRICT_NUL_HANDLING`](../macros/json_strict_nul_handling.md) macro to opt into rejecting it instead. [`JSON_STRICT_NUL_HANDLING`](../macros/json_strict_nul_handling.md) macro to opt into rejecting it instead.
!!! tip "Parsing into a document instead of a value"
[`basic_json_document::parse`](../basic_json_document/parse.md) accepts the same inputs and the same options, but
keeps the result as a flat index of the parsed values instead of a tree of `basic_json` values. It is faster and uses
less memory when only parts of the document are read, and it also accepts a pointer to a null-terminated wide string,
which `parse()` does not. See [Zero-copy JSON views](../../features/json_view.md).
!!! tip "Performance" !!! tip "Performance"
Contiguous inputs (strings, string views, vectors, arrays, pointer ranges) are the fastest to parse. A Contiguous inputs (strings, string views, vectors, arrays, pointer ranges) are the fastest to parse. A
@@ -264,22 +250,6 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
--8<-- "examples/trailing_commas.output" --8<-- "examples/trailing_commas.output"
``` ```
??? example "Example: parse from UTF-16, UTF-32, and wide strings"
The encoding is deduced from the character type of the input; `std::u16string` and `std::u32string` are interpreted
as UTF-16 and UTF-32, and `std::wstring` uses the platform's `wchar_t` width. String literals like `u"..."`,
`U"..."`, and `L"..."` work as well, as do iterators over wide characters.
```cpp
--8<-- "examples/parse__wide_string.cpp"
```
Output:
```json
--8<-- "examples/parse__wide_string.output"
```
## See also ## See also
- [accept](accept.md) - check if the input is valid JSON - [accept](accept.md) - check if the input is valid JSON
@@ -310,9 +280,6 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
time). time).
- Parsing from a `FILE*` locks the file once instead of once per character in version 3.13.0 - Parsing from a `FILE*` locks the file once instead of once per character in version 3.13.0
([`JSON_DISABLE_UNLOCKED_FILE_IO`](../macros/json_disable_unlocked_file_io.md) restores `std::fgetc`). ([`JSON_DISABLE_UNLOCKED_FILE_IO`](../macros/json_disable_unlocked_file_io.md) restores `std::fgetc`).
- Ill-formed UTF-16 and UTF-32 input (a lone surrogate, a high surrogate that is not followed by its low surrogate, or
a code point above `U+10FFFF`) is rejected with `parse_error.101` in version 3.13.0; before that, some such
sequences were accepted or ended the input silently.
!!! warning "Deprecation" !!! warning "Deprecation"
@@ -84,4 +84,4 @@ or the end of file. This also holds true when reading a byte vector for binary f
## Version history ## Version history
- Added in version 3.0.0. - Since version 3.0.0.
+3 -3
View File
@@ -125,6 +125,6 @@ throws.
## Version history ## Version history
1. Added in version 1.0.0. 1. Since version 1.0.0.
2. Added in version 1.0.0. 2. Since version 1.0.0.
3. Added in version 2.0.0. 3. Since version 2.0.0.
@@ -31,10 +31,6 @@ Read from input and generate SAX events
respectively as UTF-8, UTF-16, and UTF-32. If `SentinelType` differs from `IteratorType`, it must be comparable to respectively as UTF-8, UTF-16, and UTF-32. If `SentinelType` differs from `IteratorType`, it must be comparable to
the iterator type with `operator!=`. the iterator type with `operator!=`.
Ill-formed UTF-16 and UTF-32 sequences are rejected: a lone surrogate, a high surrogate that is not followed by its
low surrogate, and a code point above `U+10FFFF` all yield a
[`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101).
The SAX event lister must follow the interface of [`json_sax`](../json_sax/index.md). The SAX event lister must follow the interface of [`json_sax`](../json_sax/index.md).
## Template parameters ## Template parameters
@@ -46,12 +42,8 @@ The SAX event lister must follow the interface of [`json_sax`](../json_sax/index
- a `FILE` pointer - a `FILE` pointer
- a C-style array of characters - a C-style array of characters
- a pointer to a null-terminated string of single byte characters - a pointer to a null-terminated string of single byte characters
- a `std::string` or a `std::string_view` (C++17)
- a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators - a container `obj` for which `begin(obj)` and `end(obj)` produce a valid pair of iterators
(as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`) (as found via ADL or member functions, with semantics compatible to `std::begin` and `std::end`)
- wide characters (`wchar_t`, `char16_t`, `char32_t`), which are converted to UTF-8: a wide string object
(`std::wstring`, `std::u16string`, `std::u32string`) or an array (e.g. a wide string literal); a pointer to a
null-terminated wide string (e.g. `std::u16string::c_str()`) is not supported
`IteratorType` `IteratorType`
: a compatible iterator type for overload (2); a pair of character iterators whose `value_type` is an integral type : a compatible iterator type for overload (2); a pair of character iterators whose `value_type` is an integral type
@@ -168,9 +160,6 @@ use the same file with stdio functions, but it must not wait for another thread
([`JSON_DISABLE_STREAM_BULK_SCAN`](../macros/json_disable_stream_bulk_scan.md)). ([`JSON_DISABLE_STREAM_BULK_SCAN`](../macros/json_disable_stream_bulk_scan.md)).
- Parsing from a `FILE*` locks the file once instead of once per character in version 3.13.0 - Parsing from a `FILE*` locks the file once instead of once per character in version 3.13.0
([`JSON_DISABLE_UNLOCKED_FILE_IO`](../macros/json_disable_unlocked_file_io.md)). ([`JSON_DISABLE_UNLOCKED_FILE_IO`](../macros/json_disable_unlocked_file_io.md)).
- Ill-formed UTF-16 and UTF-32 input (a lone surrogate, a high surrogate that is not followed by its low surrogate, or
a code point above `U+10FFFF`) is rejected with `parse_error.101` in version 3.13.0; before that, some such
sequences were accepted or ended the input silently.
!!! warning "Deprecation" !!! warning "Deprecation"
+7 -7
View File
@@ -182,10 +182,10 @@ Constant.
## Version history ## Version history
1. Added in version 1.0.0. Exchanges the `json_base_class_t` subobject along with the value since version 3.13.0. 1. Since version 1.0.0. Exchanges the `json_base_class_t` subobject along with the value since version 3.13.0.
2. Added in version 1.0.0. Exchanges the `json_base_class_t` subobject along with the value since version 3.13.0. 2. Since version 1.0.0. Exchanges the `json_base_class_t` subobject along with the value since version 3.13.0.
3. Added in version 1.0.0. 3. Since version 1.0.0.
4. Added in version 1.0.0. 4. Since version 1.0.0.
5. Added in version 1.0.0. 5. Since version 1.0.0.
6. Added in version 3.8.0. 6. Since version 3.8.0.
7. Added in version 3.8.0. 7. Since version 3.8.0.
@@ -124,3 +124,5 @@ Linear in the size of the JSON value `j`.
[`JSON_STRICT_BINARY_UTF8`](../macros/json_strict_binary_utf8.md) is enabled) throws `type_error.316`. [`JSON_STRICT_BINARY_UTF8`](../macros/json_strict_binary_utf8.md) is enabled) throws `type_error.316`.
- Throws `type_error.321` for a discarded value since version 3.13.0; previously, a discarded value nested in an - Throws `type_error.321` for a discarded value since version 3.13.0; previously, a discarded value nested in an
array or object was silently skipped, producing invalid BJData. array or object was silently skipped, producing invalid BJData.
- Writes unsigned integers wider than 64 bits as high-precision numbers since version 3.13.0; previously, they were
silently truncated to 64 bits.
@@ -76,4 +76,4 @@ classDiagram
## Version history ## Version history
- Added in version 3.0.0. - Since version 3.0.0.
+6 -3
View File
@@ -231,8 +231,11 @@ changes to any JSON value.
1. Added in version 1.0.0. Changed parameter `default_value` type from `const ValueType&` to `ValueType&&` in version 1. Added in version 1.0.0. Changed parameter `default_value` type from `const ValueType&` to `ValueType&&` in version
3.11.0. Deleted overload for integral key types added in version 3.13.0 to reject such calls at compile time 3.11.0. Deleted overload for integral key types added in version 3.13.0 to reject such calls at compile time
instead of causing undefined behavior at runtime. instead of causing undefined behavior at runtime.
2. Added in version 3.11.0. Made `ValueType` the first template parameter in version 3.11.2. Support for keys 2. Added in version 3.11.0. Made `ValueType` the first template parameter in version 3.11.2. Fixed in version 3.13.0
convertible to `std::string_view` added in version 3.13.0, consistently across the lookup functions. to consistently accept `std::string_view`-convertible keys, as already supported by
3. Added in version 2.0.2. Extended to work with arrays in version 3.13.0. Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) [`operator[]`](operator[].md), [`at`](at.md), [`find`](find.md), and other lookup functions.
3. Added in version 2.0.2. Extended to work with arrays in version 3.13.0, including fixing an issue where resolving
`ptr` through an array unexpectedly threw `out_of_range` instead of returning the resolved element (or
`default_value`, as documented). Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109)
instead of returning `default_value` for a one-character array index that is not a digit (e.g., `/x`) in version instead of returning `default_value` for a one-character array index that is not a digit (e.g., `/x`) in version
3.13.0, as it already did for longer ones. 3.13.0, as it already did for longer ones.
@@ -9,8 +9,8 @@ class basic_json_document;
A parsed JSON text, held as a flat index of its values A parsed JSON text, held as a flat index of its values
([16 bytes per value](../../home/architecture.md#node-index-of-json-views)) instead of a tree of `BasicJsonType` values. ([16 bytes per value](../../home/architecture.md#node-index-of-json-views)) instead of a tree of `BasicJsonType` values.
Strings and floating-point numbers stay in the source text; integers are converted while parsing, and strings that Strings and numbers stay in the source text; only strings that contain escapes are decoded, into one buffer owned by
contain escapes are decoded into one buffer owned by the document. [`basic_json_view`](../basic_json_view/index.md) is a read-only handle to one value of a the document. [`basic_json_view`](../basic_json_view/index.md) is a read-only handle to one value of a
`basic_json_document`; [`materialize()`](../basic_json_view/materialize.md) turns a subtree into the `basic_json_document`; [`materialize()`](../basic_json_view/materialize.md) turns a subtree into the
`BasicJsonType` value that [`BasicJsonType::parse()`](../basic_json/parse.md) would have produced for it. `BasicJsonType` value that [`BasicJsonType::parse()`](../basic_json/parse.md) would have produced for it.
@@ -115,13 +115,6 @@ points apply to every edit:
[`source_offset()`](../basic_json_view/source_offset.md) of a value introduced by an edit is [`source_offset()`](../basic_json_view/source_offset.md) of a value introduced by an edit is
`#!cpp static_cast<std::size_t>(-1)`, the same value it reports for a decoded string. `#!cpp static_cast<std::size_t>(-1)`, the same value it reports for a decoded string.
## See also
- [Zero-copy JSON views](../../features/json_view.md) - guide to documents and views
- [**basic_json_view**](../basic_json_view/index.md) - the non-owning handle to a value in a document
- [**json_document**](../json_document.md) and [**json_editable_document**](../json_editable_document.md) - the default specializations
- [**materialize**](../basic_json_view/materialize.md) - build a `basic_json` value from a view
## Version history ## Version history
- Added in version 3.13.0. - Added in version 3.13.0.
@@ -21,19 +21,17 @@ static basic_json_document parse(IteratorType first, IteratorType last,
Both overloads accept the same JSON text as [`BasicJsonType::parse()`](../basic_json/parse.md), with the same Both overloads accept the same JSON text as [`BasicJsonType::parse()`](../basic_json/parse.md), with the same
`ignore_comments`/`ignore_trailing_commas` options, but build a [`basic_json_document`](index.md) (a flat index into `ignore_comments`/`ignore_trailing_commas` options, but build a [`basic_json_document`](index.md) (a flat index into
the input) instead of a tree of `BasicJsonType` values. They accept every input `BasicJsonType::parse()` takes, and in the input) instead of a tree of `BasicJsonType` values. They take the same inputs as `BasicJsonType::parse()`. Byte
addition a pointer to a null-terminated wide string (which `BasicJsonType::parse()` rejects). Contiguous inputs of inputs that stay alive can be borrowed; all others (streams, `#!cpp FILE*`, wide characters, non-contiguous
single-byte characters that stay alive can be borrowed; all others (streams, `#!cpp FILE*`, wide characters, which iterators) are read into a copy that the document owns -- see the Notes. Use [`parse_copy()`](parse_copy.md) to get an
must be converted to UTF-8, and non-contiguous iterators) are read into a copy that the document owns -- see the owned copy of a borrowable input as well.
Notes. Use [`parse_copy()`](parse_copy.md) to get an owned copy of a borrowable input
as well.
## Template parameters ## Template parameters
`InputType` `InputType`
: A compatible input, for instance: : A compatible input, for instance:
- a `#!cpp std::string`, a `#!cpp std::string_view` (C++17), or a C-style array of single-byte characters - a `#!cpp std::string`, `#!cpp std::string_view`, or a C-style array of single-byte characters
- a pointer to a null-terminated string of single-byte characters (`#!cpp char`, `#!cpp signed char`, - a pointer to a null-terminated string of single-byte characters (`#!cpp char`, `#!cpp signed char`,
`#!cpp unsigned char`, `#!cpp std::uint8_t`) `#!cpp unsigned char`, `#!cpp std::uint8_t`)
- a container for which `#!cpp obj.data()` and `#!cpp obj.size()` give contiguous single-byte access, e.g. - a container for which `#!cpp obj.data()` and `#!cpp obj.size()` give contiguous single-byte access, e.g.
@@ -49,10 +47,6 @@ as well.
`#!cpp std::string::iterator`; the iterators of single-byte characters are borrowed or read like the byte inputs `#!cpp std::string::iterator`; the iterators of single-byte characters are borrowed or read like the byte inputs
above, those of wide characters are converted to UTF-8 above, those of wide characters are converted to UTF-8
Ill-formed UTF-16 and UTF-32 sequences are rejected: a lone surrogate, a high surrogate that is not followed by its low
surrogate, and a code point above `U+10FFFF` all yield a
[`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101).
## Parameters ## Parameters
`input` (in) `input` (in)
@@ -161,5 +155,3 @@ buffer of a given length, pass a pair of pointers: `#!cpp parse(ptr, ptr + len)`
## Version history ## Version history
- Added in version 3.13.0. - Added in version 3.13.0.
- Ill-formed UTF-16 and UTF-32 input (a lone surrogate, a high surrogate that is not followed by its low surrogate, or
a code point above `U+10FFFF`) is rejected with `parse_error.101`.
@@ -143,13 +143,6 @@ still refers to it -- including ones taken before the change -- reads the new va
- [**source_offset**](source_offset.md) - byte offset of this value in the document's source text - [**source_offset**](source_offset.md) - byte offset of this value in the document's source text
## See also
- [Zero-copy JSON views](../../features/json_view.md) - guide to documents and views
- [**basic_json_document**](../basic_json_document/index.md) - the document that owns the parsed data
- [**json_view**](../json_view.md) and [**json_editable_view**](../json_editable_view.md) - the default specializations
- [**materialize**](materialize.md) - build a `basic_json` value from a view
## Version history ## Version history
- Added in version 3.13.0. - Added in version 3.13.0.
@@ -51,4 +51,4 @@ byte_container_with_subtype(container_type&& container, subtype_type subtype);
## Version history ## Version history
Added in version 3.8.0. Since version 3.8.0.
@@ -39,4 +39,4 @@ Constant.
## Version history ## Version history
Added in version 3.8.0. Since version 3.8.0.
@@ -42,4 +42,4 @@ Constant.
## Version history ## Version history
Added in version 3.8.0. Since version 3.8.0.
@@ -29,14 +29,6 @@ specific naming scheme in order to override the binary type.
- [**has_subtype**](has_subtype.md) - return whether the value has a subtype - [**has_subtype**](has_subtype.md) - return whether the value has a subtype
- [**clear_subtype**](clear_subtype.md) - clears the binary subtype - [**clear_subtype**](clear_subtype.md) - clears the binary subtype
## See also
- [Binary values](../../features/binary_values.md) - how binary values and subtypes are handled
- [**binary**](../basic_json/binary.md) - create a binary array value
- [**get_binary**](../basic_json/get_binary.md) - get a reference to the stored binary value
- [**binary_t**](../basic_json/binary_t.md) - type for binary arrays
- [Binary formats](../../features/binary_formats/index.md) - formats that can store binary values
## Version history ## Version history
- Added in version 3.8.0. - Added in version 3.8.0.
@@ -44,4 +44,4 @@ Constant.
## Version history ## Version history
Added in version 3.8.0. Since version 3.8.0.
+1 -1
View File
@@ -30,4 +30,4 @@ types.
## Version history ## Version history
Added in version 1.0.0. Since version 1.0.0.
+1 -1
View File
@@ -32,4 +32,4 @@ specialization.
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
@@ -40,4 +40,4 @@ parsing, without ever rewriting the source text -- see [Edits](basic_json_docume
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
+1 -1
View File
@@ -38,4 +38,4 @@ still referring to it seeing the change, see [Edits](basic_json_document/index.m
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
@@ -51,5 +51,5 @@ operator string_t() const
## Version history ## Version history
- Added in version 2.0.0. - Since version 2.0.0.
- Changed type to `string_t` and deprecated in version 3.11.0. - Changed type to `string_t` and deprecated in version 3.11.0.
@@ -49,5 +49,5 @@ ptr == json_pointer(ptr.to_string());
## Version history ## Version history
- Added in version 2.0.0. - Since version 2.0.0.
- Changed return type to `string_t` in version 3.11.0. - Changed return type to `string_t` in version 3.11.0.
-7
View File
@@ -59,13 +59,6 @@ leading `-` sign.
- [**start_object**](start_object.md) (_virtual_) - the beginning of an object was read - [**start_object**](start_object.md) (_virtual_) - the beginning of an object was read
- [**string**](string.md) (_virtual_) - a string value was read - [**string**](string.md) (_virtual_) - a string value was read
## See also
- [SAX interface](../../features/parsing/sax_interface.md) - guide to event-based parsing
- [**sax_parse**](../basic_json/sax_parse.md) - generate SAX events from an input
- [**parse**](../basic_json/parse.md) - DOM parsing, with optional [parser callbacks](../../features/parsing/parser_callbacks.md)
- [Parse exceptions](../../features/parsing/parse_exceptions.md)
## Version history ## Version history
- Added in version 3.2.0. - Added in version 3.2.0.
+1 -1
View File
@@ -31,4 +31,4 @@ This type is a [`basic_json_view`](basic_json_view/index.md) of a value of a [`j
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
+1 -10
View File
@@ -137,13 +137,4 @@ header. See also the [macro overview page](../../features/macros.md).
- [**NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT_WITH_NAMES**](nlohmann_define_type_with_names.md) - serialize/deserialize - [**NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT_WITH_NAMES**](nlohmann_define_type_with_names.md) - serialize/deserialize
a derived class; uses default values; uses custom names a derived class; uses default values; uses custom names
- [**NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE_WITH_NAMES**](nlohmann_define_type_with_names.md) - serialize a derived - [**NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE_WITH_NAMES**](nlohmann_define_type_with_names.md) - serialize a derived
class; uses custom names class; uses custom names
## See also
- [Macros](../../features/macros.md) - guide to the supported macros
- [Runtime assertions](../../features/assertions.md)
- [Arbitrary type conversions](../../features/arbitrary_types.md) - using the `NLOHMANN_DEFINE_TYPE_*` macros
- [Enum conversion](../../features/enum_conversion.md) - using `NLOHMANN_JSON_SERIALIZE_ENUM`
- [The `nlohmann` namespace](../../features/namespace.md)
- [CMake integration](../../integration/cmake.md) - setting macros from the build system
+2 -2
View File
@@ -38,7 +38,7 @@ Therefore, assertions can be switched off by defining `NDEBUG`.
```cpp ```cpp
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -64,7 +64,7 @@ Therefore, assertions can be switched off by defining `NDEBUG`.
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -79,7 +79,7 @@ The default value is `0` (disabled — existing behavior is preserved).
```cpp ```cpp
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -98,7 +98,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#define JSON_BRACE_INIT_COPY_SEMANTICS 1 #define JSON_BRACE_INIT_COPY_SEMANTICS 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -54,7 +54,7 @@ The default value is `0` (disabled, the deprecated functions can still be called
```cpp ```cpp
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -72,7 +72,7 @@ The default value is `0` (disabled, the deprecated functions can still be called
#define JSON_DELETE_DEPRECATED_FUNCTIONS 1 #define JSON_DELETE_DEPRECATED_FUNCTIONS 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -39,7 +39,7 @@ The default value is `0`.
#define JSON_DISABLE_ENUM_SERIALIZATION 1 #define JSON_DISABLE_ENUM_SERIALIZATION 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
enum class Choice enum class Choice
{ {
@@ -66,7 +66,7 @@ The default value is `0`.
#define JSON_DISABLE_ENUM_SERIALIZATION 1 #define JSON_DISABLE_ENUM_SERIALIZATION 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
enum class Choice enum class Choice
{ {
@@ -99,7 +99,7 @@ The default value is `0`.
#define JSON_DISABLE_ENUM_SERIALIZATION 1 #define JSON_DISABLE_ENUM_SERIALIZATION 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
enum class Choice enum class Choice
{ {
@@ -92,7 +92,7 @@ The default value is `0`: streams are scanned in bulk.
#include <sstream> #include <sstream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -115,7 +115,7 @@ The default value is `0`: streams are scanned in bulk.
#include <sstream> #include <sstream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -72,7 +72,7 @@ The default value is `0` (disabled — existing behavior is preserved).
```cpp ```cpp
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -89,7 +89,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#define JSON_DISABLE_TUPLE_REFERENCE_CONVERSION 1 #define JSON_DISABLE_TUPLE_REFERENCE_CONVERSION 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -73,7 +73,7 @@ The default value is `0`: the file is locked once and read with the unlocked std
#include <cstdio> #include <cstdio>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -92,7 +92,7 @@ The default value is `0`: the file is locked once and read with the unlocked std
#include <cstdio> #include <cstdio>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
+1 -1
View File
@@ -61,7 +61,7 @@ By default, `#!cpp JSON_NO_SIMD` is not defined, and vector instructions are use
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -94,7 +94,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <sstream> #include <sstream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -115,7 +115,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <sstream> #include <sstream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -64,7 +64,7 @@ The default value is `0` (disabled, the behavior of version 3.12.0 and earlier i
```cpp ```cpp
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -81,7 +81,7 @@ The default value is `0` (disabled, the behavior of version 3.12.0 and earlier i
#define JSON_STRICT_BINARY_UTF8 1 #define JSON_STRICT_BINARY_UTF8 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -92,7 +92,7 @@ The default value is `0` (disabled — existing behavior is preserved).
```cpp ```cpp
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -109,7 +109,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#define JSON_STRICT_NUL_HANDLING 1 #define JSON_STRICT_NUL_HANDLING 1
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -77,7 +77,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <map> #include <map>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
enum TaskState { TS_STOPPED, TS_RUNNING, TS_COMPLETED }; enum TaskState { TS_STOPPED, TS_RUNNING, TS_COMPLETED };
@@ -105,7 +105,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <map> #include <map>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
enum TaskState { TS_STOPPED, TS_RUNNING, TS_COMPLETED }; enum TaskState { TS_STOPPED, TS_RUNNING, TS_COMPLETED };
+1 -1
View File
@@ -42,4 +42,4 @@ parsing an object of `n` keys costs O(n²) rather than O(n log n). See
## Version history ## Version history
Added in version 3.9.0. Since version 3.9.0.
@@ -35,4 +35,4 @@ of object keys, instead of sorting them like [`json_document`](json_document.md)
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
@@ -44,4 +44,4 @@ members [`set`](basic_json_document/set.md) added -- instead of sorting them lik
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
@@ -37,4 +37,4 @@ This type is a [`basic_json_view`](basic_json_view/index.md) of a value of an
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
+1 -1
View File
@@ -32,4 +32,4 @@ This type is a [`basic_json_view`](basic_json_view/index.md) of a value of an
## Version history ## Version history
Added in version 3.13.0. Since version 3.13.0.
@@ -188,13 +188,10 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa
``` ```
- [x] The code is checked with the latest [Cppcheck](https://cppcheck.sourceforge.io) with all warnings enabled. - [x] The code is checked with the latest [Cppcheck](https://cppcheck.sourceforge.io) with all warnings enabled.
- [x] The code is checked with the latest [Clang Static Analyzer](https://clang-analyzer.llvm.org) with 52 enabled - [x] The code is checked with the latest [Clang Static Analyzer](https://clang-analyzer.llvm.org) with 89 enabled
checkers. rules.
- [x] The code is checked with [Infer](https://fbinfer.com). - [x] The code is checked with [Infer](https://fbinfer.com).
- [x] The code is checked with [Codacy](https://app.codacy.com/gh/nlohmann/json/dashboard). - [x] The code is checked with [Codacy](https://app.codacy.com/gh/nlohmann/json/dashboard).
- [x] The code is scanned with [CodeQL](https://codeql.github.com), [Semgrep](https://semgrep.dev), and
[Flawfinder](https://dwheeler.com/flawfinder/) on every push and pull request and on a schedule; the findings are
reported to GitHub's code scanning.
## Dynamic analysis ## Dynamic analysis
@@ -207,8 +204,6 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa
- [x] The test suite is executed with [Valgrind](https://valgrind.org) (Memcheck) to detect memory leaks. - [x] The test suite is executed with [Valgrind](https://valgrind.org) (Memcheck) to detect memory leaks.
- [x] The test suite is executed with [Sanitizers](https://github.com/google/sanitizers) (address sanitizer, undefined - [x] The test suite is executed with [Sanitizers](https://github.com/google/sanitizers) (address sanitizer, undefined
behavior sanitizer, integer overflow detection, nullability violations). behavior sanitizer, integer overflow detection, nullability violations).
- [x] The fuzz targets are run with [CIFuzz](https://google.github.io/oss-fuzz/getting-started/continuous-integration/)
on every pull request to catch regressions before they are merged.
## Dependencies ## Dependencies
@@ -228,8 +223,6 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa
No release is made while such an alert is open. No release is made while such an alert is open.
- [x] Third-party code included in the repository for testing, such as [doctest](https://github.com/doctest/doctest), - [x] Third-party code included in the repository for testing, such as [doctest](https://github.com/doctest/doctest),
is updated manually. is updated manually.
- [x] The repository is evaluated with the [OpenSSF Scorecard](https://securityscorecards.dev) on a schedule and on
every push to the default branch, and the results are reported to GitHub's code scanning.
## Style check ## Style check
@@ -265,21 +258,4 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa
- [x] The library is tested against relevant CMake versions: - [x] The library is tested against relevant CMake versions:
- CMake 3.5 (the earliest supported) - CMake 3.5 (the earliest supported)
- CMake 3.31.6 (the latest 3.x release) - CMake 3.31.6 (the latest 3.x release)
- CMake 4.0.0 (the first 4.x release) - CMake 4.0.0 (a very recent release)
!!! success "Requirement: Other build systems"
The library can be used with build systems and package managers other than CMake.
- [x] The library can be consumed with [Meson](https://json.nlohmann.me/integration/package_managers/) and the Swift
Package Manager; the installation with Meson and the resolution of `Package.swift` are tested in the CI.
!!! success "Requirement: Reproducible and verifiable builds"
The library can be built and tested without network access or a Git checkout, and its licensing is machine-readable.
- [x] The test suite is executed from an exported source tree without the `.git` directory and with the test data
being available offline.
- [x] The test suite is executed without the tests that change installed files to check that builds are reproducible.
- [x] The repository is checked for compliance with the [REUSE specification](https://reuse.software) so that the
license and copyright of every file is machine-readable.
- [x] The documentation is built with warnings treated as errors, and its links are checked regularly.
+1 -1
View File
@@ -58,7 +58,7 @@ particular, a 3.x release does not:
- remove or rename a documented macro, CMake option, CMake target, or header, or change what a documented macro does. - remove or rename a documented macro, CMake option, CMake target, or header, or change what a documented macro does.
Exceptions to these rules, for instance when fixing a bug requires changing the exception a function throws, are Exceptions to these rules, for instance when fixing a bug requires changing the exception a function throws, are
documented in the [release notes](../home/releases/index.md). documented in the [release notes](../home/releases.md).
The following are **not** part of the public API and may change in any release, including patch releases: The following are **not** part of the public API and may change in any release, including patch releases:
-29
View File
@@ -18,32 +18,3 @@
white-space: nowrap; white-space: nowrap;
cursor: help; cursor: help;
} }
/* byte layout tables of the binary formats */
.md-typeset .byte-layout td code {
white-space: pre-wrap;
}
.md-typeset .bl {
display: inline-block;
padding: 0 .25em;
border-radius: .2em;
font-family: var(--md-code-font-family);
font-size: .85em;
white-space: nowrap;
}
.md-typeset .bl-t {
background-color: rgba(66, 133, 244, .25);
box-shadow: inset 0 -.12em 0 rgba(66, 133, 244, .8);
}
.md-typeset .bl-l {
background-color: rgba(251, 140, 0, .25);
box-shadow: inset 0 -.12em 0 rgba(251, 140, 0, .8);
}
.md-typeset .bl-d {
background-color: rgba(67, 160, 71, .25);
box-shadow: inset 0 -.12em 0 rgba(67, 160, 71, .8);
}
+1 -1
View File
@@ -2,7 +2,7 @@
#include <iomanip> #include <iomanip>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -2,7 +2,7 @@
#include <vector> #include <vector>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
+3 -3
View File
@@ -2,19 +2,19 @@
#include <iomanip> #include <iomanip>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
// a valid JSON text // a valid JSON text
const auto* valid_text = R"( auto valid_text = R"(
{ {
"numbers": [1, 2, 3] "numbers": [1, 2, 3]
} }
)"; )";
// an invalid JSON text // an invalid JSON text
const auto* invalid_text = R"( auto invalid_text = R"(
{ {
"strings": ["extra", "comma", ] "strings": ["extra", "comma", ]
} }
@@ -1,18 +0,0 @@
#include <iostream>
#include <string>
#include <nlohmann/json.hpp>
using nlohmann::json;
int main()
{
// a valid JSON text, given as UTF-16
const std::u16string valid_text = u"{\"name\":\"\u00e9\"}";
// an invalid JSON text, given as UTF-16
const std::u16string invalid_text = u"{\"name\":\"\u00e9\",}";
std::cout << std::boolalpha
<< json::accept(valid_text) << ' '
<< json::accept(invalid_text) << '\n';
}
@@ -1 +0,0 @@
true false
+1 -1
View File
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
+2 -2
View File
@@ -2,9 +2,9 @@
#include <iomanip> #include <iomanip>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
std::cout << std::boolalpha << std::is_same<std::vector<json>, json::array_t>::value << '\n'; std::cout << std::boolalpha << std::is_same<std::vector<json>, json::array_t>::value << std::endl;
} }
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
using namespace nlohmann::literals; using namespace nlohmann::literals;
int main() int main()
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
using namespace nlohmann::literals; using namespace nlohmann::literals;
int main() int main()
@@ -3,7 +3,7 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using namespace std::string_view_literals; using namespace std::string_view_literals;
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -3,7 +3,7 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using namespace std::string_view_literals; using namespace std::string_view_literals;
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
+1 -1
View File
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
+1 -1
View File
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,8 +1,8 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
using nlohmann::ordered_json; using ordered_json = nlohmann::ordered_json;
int main() int main()
{ {
@@ -8,7 +8,7 @@
#include <valarray> #include <valarray>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
@@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
using nlohmann::json; using json = nlohmann::json;
int main() int main()
{ {
Loaded 100 of 566 files, more files were not shown because too many files have changed in this diff. Show more