Compare commits

..
Author SHA1 Message Date
Niels Lohmann 367bf19bc2 json_view: one SIMD macro set with the library
The view's vector code follows JSON_NO_SIMD, like the lexer and the float
writer, and skips the CPU check of SSSE3 when the code is compiled for
SSSE3 anyway (__SSSE3__), like the lexer. JSON_VIEW_NO_SIMD and
JSON_VIEW_USE_SSSE3 and their ABI tags _vns and _vssse3 are removed; they
were never released. JSON_NO_SIMD keeps its tag _ns.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-25 20:41:51 +01:00
Niels Lohmann f0e049e7ae json_view: no save() and load() on big-endian targets
The image format is little-endian only. Instead of throwing
type_error.320 at runtime, save_image(), load_image() and the members
save() and load() do not exist on a big-endian target, so a call fails to
compile, like set() on a read-only document. type_error.320 remains for
saving a discarded document.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-25 20:41:48 +01:00
Niels Lohmann 266432ea65 json_view: view_mode enum instead of bool Editable, node_kind for node::kind
basic_json_document and basic_json_view take a view_mode (read_only, the
default, or editable) instead of a bool: basic_json_document<json, true>
did not say what true means. The shortcut aliases are unchanged.

The kind of a node is a node_kind (the value_t values plus link, 10 as
before), which removes the static_cast<std::uint8_t>(value_t::...) of
every comparison. The node and image layouts are unchanged.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-25 20:41:47 +01:00
510 changed files with 3178 additions and 9096 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
# by every supported compiler, and tools/amalgamate/amalgamate.py strips it from
# single_include, so there is nothing left to fix here.
@@ -40,14 +10,14 @@ Checks: '*,
-android-cloexec-fopen,
-boost-use-ranges,
-bugprone-easily-swappable-parameters,
-bugprone-signed-bitwise,
-cert-err58-cpp,
-clang-analyzer-webkit.NoUncountedMemberChecker,
-concurrency-mt-unsafe,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-explicit-constructor,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
@@ -56,15 +26,19 @@ Checks: '*,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-rvalue-reference-param-not-moved,
-cppcoreguidelines-virtual-class-destructor,
-fuchsia-default-arguments-calls,
-fuchsia-default-arguments-declarations,
-fuchsia-overloaded-operator,
-google-explicit-constructor,
-google-readability-function-size,
-google-runtime-float,
-google-runtime-int,
-hicpp-avoid-goto,
-hicpp-explicit-conversions,
-hicpp-function-size,
-hicpp-no-array-decay,
-hicpp-no-assembler,
-hicpp-signed-bitwise,
-hicpp-uppercase-literal-suffix,
-llvm-header-guard,
@@ -74,7 +48,6 @@ Checks: '*,
-llvmlibc-*,
-misc-use-anonymous-namespace,
-misc-confusable-identifiers,
-misc-explicit-constructor,
-misc-include-cleaner,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
@@ -82,22 +55,20 @@ Checks: '*,
-modernize-type-traits,
-modernize-use-constraints,
-modernize-use-designated-initializers,
-modernize-use-integer-sign-comparison,
-modernize-use-nodiscard,
-modernize-use-ranges,
-modernize-use-string-view,
-modernize-use-std-numbers,
-modernize-use-trailing-return-type,
-performance-enum-size,
-portability-avoid-pragma-once,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-magic-numbers,
-readability-redundant-access-specifiers,
-readability-redundant-parentheses,
-readability-redundant-typename,
-readability-simplify-boolean-expr,
-readability-trailing-comma,
-readability-uppercase-literal-suffix,
-readability-use-concise-preprocessor-directives'
+3 -3
View File
@@ -163,9 +163,9 @@ jobs:
python3 $GENERATOR --list-tags
TAG_COUNT=$(python3 $GENERATOR --list-tags | wc -l)
python3 $GENERATOR --abi-tags diag,_dp,_vns --abi-tags _diag --output $RUNNER_TEMP/abi_tags.natvis
grep -q '<!-- Namespace nlohmann::json_abi_diag_dp_vns -->' $RUNNER_TEMP/abi_tags.natvis
grep -q '<!-- Namespace nlohmann::json_abi_diag_dp_vns_v[0-9_]* -->' $RUNNER_TEMP/abi_tags.natvis
python3 $GENERATOR --abi-tags diag,_dp,_ns --abi-tags _diag --output $RUNNER_TEMP/abi_tags.natvis
grep -q '<!-- Namespace nlohmann::json_abi_diag_dp_ns -->' $RUNNER_TEMP/abi_tags.natvis
grep -q '<!-- Namespace nlohmann::json_abi_diag_dp_ns_v[0-9_]* -->' $RUNNER_TEMP/abi_tags.natvis
test $(grep -c '<!-- Namespace ' $RUNNER_TEMP/abi_tags.natvis) -eq $(( $(grep -c '<!-- Namespace ' nlohmann_json.natvis) + 2 ))
python3 $GENERATOR --all --output $RUNNER_TEMP/all.natvis
+1 -2
View File
@@ -43,8 +43,7 @@ jobs:
- name: flawfinder_scan
uses: david-a-wheeler/flawfinder@c4216b74cf2639ffa98503768bd6e4299b5440c9 # v2.0.20
with:
# single_include/ is omitted: it is generated from include/ and would report every finding twice
arguments: '--sarif ./cmake ./docs ./include ./src ./tests ./tools'
arguments: '--sarif ./'
output: 'flawfinder_results.sarif'
- name: Upload analysis results to GitHub Security tab
+1
View File
@@ -90,6 +90,7 @@ cc_library(
"include/nlohmann/detail/view/simd.hpp",
"include/nlohmann/detail/view/string_ref.hpp",
"include/nlohmann/detail/view/value.hpp",
"include/nlohmann/detail/view/view_mode.hpp",
"include/nlohmann/json.hpp",
"include/nlohmann/json_fwd.hpp",
"include/nlohmann/json_literals.hpp",
+1 -1
View File
@@ -309,7 +309,7 @@ The "Check amalgamation" workflow fails if the file is out of date.
The file covers the namespace variants with up to two ABI tags. A Natvis file for other configurations can be
generated with the `--abi-tags` or `--all` options, for example
`make natvis NATVIS_ARGS="--abi-tags _diag,_dp,_vns --output my_nlohmann_json.natvis"`; see
`make natvis NATVIS_ARGS="--abi-tags _diag,_dp,_ns --output my_nlohmann_json.natvis"`; see
[`tools/generate_natvis`](tools/generate_natvis/README.md). With MSVC, CMake adds the file to the `nlohmann_json`
target and installs it.
+1 -1
View File
@@ -120,7 +120,7 @@ $(AMALGAMATED_VIEW_FILE): $(SRCS)
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json_view.json -s . --verbose=yes
NATVIS_VENV=tools/generate_natvis/venv
# extra options for generate_natvis.py, e.g. NATVIS_ARGS="--abi-tags _diag,_dp,_vns --output my.natvis"
# extra options for generate_natvis.py, e.g. NATVIS_ARGS="--abi-tags _diag,_dp,_ns --output my.natvis"
NATVIS_ARGS=
# regenerate nlohmann_json.natvis from the ABI tags and version in include/nlohmann/detail/abi_macros.hpp
+4 -4
View File
@@ -151,7 +151,7 @@ The `json` class provides an API for manipulating a JSON value. To create a `jso
```cpp
#include <fstream>
#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 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:
```cpp
using nlohmann::json;
using json = nlohmann::json;
namespace ns {
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>
// 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).
@@ -113,15 +113,15 @@ basic_json(basic_json&& other) noexcept;
```mermaid
flowchart TD
A(["initializer_list init"]) --> B{{"empty, or every element is a 2-element<br/>array whose first element is a string?"}}
B -->|"yes"| C{{"type_deduction"}}
B -->|"no"| D{{"type_deduction"}}
A(["initializer_list init"]) --> B{"empty, or every element is a 2-element<br/>array whose first element is a string?"}
B -->|"yes"| C{"type_deduction"}
B -->|"no"| D{"type_deduction"}
C -->|"true"| OBJ["create object"]
C -->|"false"| E{{"manual_type"}}
C -->|"false"| E{"manual_type"}
E -->|"object"| OBJ
E -->|"array"| ARR["create array"]
D -->|"true"| ARR
D -->|"false"| F{{"manual_type"}}
D -->|"false"| F{"manual_type"}
F -->|"array"| ARR
F -->|"object"| ERR["throw type_error.301"]
```
+1 -3
View File
@@ -7,9 +7,7 @@ const_iterator begin() const noexcept;
Returns an iterator to the first element.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-begin-end.svg"
</div>
![Illustration from cppreference.com](../../images/range-begin-end.svg)
## Return value
+1 -3
View File
@@ -6,9 +6,7 @@ const_iterator cbegin() const noexcept;
Returns an iterator to the first element.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-begin-end.svg"
</div>
![Illustration from cppreference.com](../../images/range-begin-end.svg)
## Return value
+1 -3
View File
@@ -6,9 +6,7 @@ const_iterator cend() const noexcept;
Returns an iterator to one past the last element.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-begin-end.svg"
</div>
![Illustration from cppreference.com](../../images/range-begin-end.svg)
## Return value
+1 -3
View File
@@ -6,9 +6,7 @@ const_reverse_iterator crbegin() const noexcept;
Returns an iterator to the reverse-beginning; that is, the last element.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-rbegin-rend.svg"
</div>
![Illustration from cppreference.com](../../images/range-rbegin-rend.svg)
## Return value
+1 -3
View File
@@ -7,9 +7,7 @@ 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.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-rbegin-rend.svg"
</div>
![Illustration from cppreference.com](../../images/range-rbegin-rend.svg)
## Return value
+1 -3
View File
@@ -7,9 +7,7 @@ const_iterator end() const noexcept;
Returns an iterator to one past the last element.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-begin-end.svg"
</div>
![Illustration from cppreference.com](../../images/range-begin-end.svg)
## Return value
+1 -1
View File
@@ -45,7 +45,7 @@ Constant.
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -22,9 +22,7 @@ The parser callback distinguishes the following events:
## Examples
<div class="nj-fig-wrap" markdown>
--8<-- "images/callback_events.svg"
</div>
![Example when certain parse events are triggered](../../images/callback_events.png)
??? example
@@ -23,9 +23,7 @@ table describes the values of the parameters `depth`, `event`, and `parsed`.
| `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 |
<div class="nj-fig-wrap" markdown>
--8<-- "images/callback_events.svg"
</div>
![Example when certain parse events are triggered](../../images/callback_events.png)
Discarding a value (i.e., returning `#!cpp false`) has different effects depending on the context in which function was
called:
+1 -3
View File
@@ -7,9 +7,7 @@ const_reverse_iterator rbegin() const noexcept;
Returns an iterator to the reverse-beginning; that is, the last element.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-rbegin-rend.svg"
</div>
![Illustration from cppreference.com](../../images/range-rbegin-rend.svg)
## Return value
+1 -3
View File
@@ -8,9 +8,7 @@ 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.
<div class="nj-fig-wrap" markdown>
--8<-- "images/range-rbegin-rend.svg"
</div>
![Illustration from cppreference.com](../../images/range-rbegin-rend.svg)
## Return value
@@ -12,7 +12,7 @@ void erase(view_type array, I idx);
std::size_t erase(const json_pointer& ptr);
```
Only an **editable** document (`#!cpp Editable == true`, e.g. [`json_editable_document`](../json_editable_document.md))
Only an **editable** document (`#!cpp view_mode::editable`, e.g. [`json_editable_document`](../json_editable_document.md))
has `erase`; calling it on a read-only `basic_json_document` fails to compile (`#!cpp static_assert`).
1. Removes every member of `object` whose key is `key` (see [Notes](#notes) on duplicate keys) and returns how many
@@ -3,7 +3,7 @@
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
template<typename BasicJsonType, bool Editable = false>
template<typename BasicJsonType, view_mode Mode = view_mode::read_only>
class basic_json_document;
```
@@ -20,9 +20,9 @@ is move-only: a copy would duplicate the whole index, the decoded-string buffer,
enough in every use we know of. The index, the decoded strings, and the owned text live in one heap block that the
document holds through a `#!cpp std::unique_ptr`; this is also why views survive a move of the document.
With `#!cpp Editable == true`, the document also offers [`set`](set.md), [`push_back`](push_back.md),
With `#!cpp Mode == view_mode::editable`, the document also offers [`set`](set.md), [`push_back`](push_back.md),
[`insert`](insert.md), and [`erase`](erase.md) to change values in place, see [Edits](#edits) below. The source text
itself is never written; a read-only document (`#!cpp Editable == false`, the default) does not carry any of the
itself is never written; a read-only document (`#!cpp view_mode::read_only`, the default) does not carry any of the
bookkeeping edits need, and calling any of them on one fails to compile (`#!cpp static_assert`).
## Template parameters
@@ -32,9 +32,10 @@ bookkeeping edits need, and calling any of them on one fails to compile (`#!cpp
[`ordered_json`](../ordered_json.md). Only 64-bit `number_integer_t`/`number_unsigned_t` types are supported; this
is checked with a `static_assert`.
`Editable`
: whether the document supports [`set`](set.md), [`push_back`](push_back.md), [`insert`](insert.md), and
[`erase`](erase.md) (optional, `#!cpp false` by default). See [Edits](#edits) below.
`Mode`
: a [`view_mode`](../view_mode.md): `#!cpp view_mode::editable` if the document supports [`set`](set.md),
[`push_back`](push_back.md), [`insert`](insert.md), and [`erase`](erase.md) (optional, `#!cpp view_mode::read_only`
by default). See [Edits](#edits) below.
## Specializations
@@ -47,7 +48,7 @@ bookkeeping edits need, and calling any of them on one fails to compile (`#!cpp
## Member types
- **view_type** - the type of view returned by [`root()`](root.md) (`#!cpp basic_json_view<BasicJsonType, Editable>`)
- **view_type** - the type of view returned by [`root()`](root.md) (`#!cpp basic_json_view<BasicJsonType, Mode>`)
- **value_t** - the JSON type enumeration, see [`basic_json::value_t`](../basic_json/value_t.md)
- **image_check** - how [`load()`](load.md) validates an image (`full`, `bounds`, `none`), see [`image_check`](load.md#image_check)
@@ -80,15 +81,15 @@ bookkeeping edits need, and calling any of them on one fails to compile (`#!cpp
### Edits
- [**set**](set.md) - replace a value, or set an object member, an array element, or the value a JSON pointer refers
to (`#!cpp Editable` documents only)
- [**push_back**](push_back.md) - append to an array (`#!cpp Editable` documents only)
- [**insert**](insert.md) - insert an element into an array before a given position (`#!cpp Editable` documents only)
to (editable documents only)
- [**push_back**](push_back.md) - append to an array (editable documents only)
- [**insert**](insert.md) - insert an element into an array before a given position (editable documents only)
- [**erase**](erase.md) - remove an object member, an array element, or the value a JSON pointer refers to
(`#!cpp Editable` documents only)
(editable documents only)
## Edits
An editable document (`#!cpp Editable == true`) can be changed after parsing, with [`set`](set.md),
An editable document (`#!cpp view_mode::editable`) can be changed after parsing, with [`set`](set.md),
[`push_back`](push_back.md), [`insert`](insert.md), and [`erase`](erase.md);
[`json_editable_document`](../json_editable_document.md) and
[`ordered_json_editable_document`](../ordered_json_editable_document.md) are the corresponding specializations. A few
@@ -5,7 +5,7 @@ template<typename I, typename V>
view_type insert(view_type array, I idx, V&& value);
```
Only an **editable** document (`#!cpp Editable == true`, e.g. [`json_editable_document`](../json_editable_document.md))
Only an **editable** document (`#!cpp view_mode::editable`, e.g. [`json_editable_document`](../json_editable_document.md))
has `insert`; calling it on a read-only `basic_json_document` fails to compile (`#!cpp static_assert`).
Inserts `value` into `array` as a new element before position `idx`, which must not be past the end
@@ -55,10 +55,7 @@ validate with overload 2 first, if the original vector must survive a failed loa
## Exceptions
On a big-endian target, throws [`type_error.320`](../../home/exceptions.md#jsonexceptiontype_error320) -- the same
exception [`save()`](save.md#exceptions) throws there, since the image format is little-endian only.
Otherwise throws [`parse_error.116`](../../home/exceptions.md#jsonexceptionparse_error116) if `image` is not one
Throws [`parse_error.116`](../../home/exceptions.md#jsonexceptionparse_error116) if `image` is not one
`save()` could have written, or fails the requested `check`:
| message | when |
@@ -95,6 +92,9 @@ are checked once, however many nodes refer to it.
## Notes
**Little-endian targets only.** On a big-endian target, `load()` does not exist, just like
[`save()`](save.md#notes): the image format is little-endian, so a call fails to compile.
### `image_check` { #image_check }
```cpp
@@ -13,7 +13,7 @@ editable, and it does not have to be `array`'s own document -- which is copied s
source document afterward; a `BasicJsonType` value; or anything `BasicJsonType` can be constructed from (numbers,
strings, `#!cpp bool`, `#!cpp nullptr`, containers, ...).
Only an **editable** document (`#!cpp Editable == true`, e.g. [`json_editable_document`](../json_editable_document.md))
Only an **editable** document (`#!cpp view_mode::editable`, e.g. [`json_editable_document`](../json_editable_document.md))
has `push_back`; calling it on a read-only `basic_json_document` fails to compile (`#!cpp static_assert`).
## Template parameters
@@ -12,7 +12,7 @@ An edited document is written in its *current* state, with its values in documen
parser would have produced them for that JSON text: a member [`set`](set.md) added goes at the end, an
[`erase`](erase.md)d member leaves no trace, and a float that is not finite (NaN or positive/negative infinity)
becomes null, the same substitution [`dump()`](../basic_json_view/dump.md) makes. The same document always saves to
the same bytes -- also across `BasicJsonType` and `#!cpp Editable`, since the image reflects document order and
the same bytes -- also across `BasicJsonType` and the [`view_mode`](../view_mode.md), since the image reflects document order and
values only, not which specialization produced them.
## Return value
@@ -31,9 +31,6 @@ Throws [`type_error.320`](../../home/exceptions.md#jsonexceptiontype_error320) i
[discarded](is_discarded.md) -- a default-constructed document, or one a failed [`parse()`](parse.md)/
[`read()`](read.md) with `allow_exceptions == false` left discarded.
On a big-endian target, throws `type_error.320` with a different message instead: the image format is little-endian
only (see [Notes](#notes)).
Throws [`out_of_range.416`](../../home/exceptions.md#jsonexceptionout_of_range416) if the node count, the text, or
the decoded strings of the image would individually reach 4 GiB -- the same 32-bit offsets
[`parse()`](parse.md#exceptions) and, for edits, [`set`](set.md)/[`push_back`](push_back.md) are already limited to.
@@ -44,9 +41,6 @@ the decoded strings of the image would individually reach 4 GiB -- the same 32-b
[json.exception.type_error.320] cannot save a discarded json_document
```
```
[json.exception.type_error.320] json_document images need a little-endian target
```
```
[json.exception.out_of_range.416] images of 4 GiB or more are not supported by json_document
```
@@ -70,9 +64,9 @@ else -- see [`load`'s Exceptions](load.md#exceptions).
the *same* build on the *same* (little-endian) machine -- not as a long-term storage format. Keep the original
JSON text if you need to read a saved document back with a future library version.
**Little-endian only.** The image is written as raw little-endian bytes, with no byte-swapping. `save()` (and
[`load`](load.md)) throw `type_error.320` on a big-endian target rather than silently produce bytes a big-endian
reader could not interpret correctly.
**Little-endian targets only.** The image is written as raw little-endian bytes, with no byte-swapping. On a
big-endian target, `save()` and [`load`](load.md) do not exist: a call fails to compile rather than produce bytes a
big-endian reader could not interpret correctly.
## Examples
@@ -18,7 +18,7 @@ template<typename V>
view_type set(const json_pointer& ptr, V&& value);
```
Only an **editable** document (`#!cpp Editable == true`, e.g. [`json_editable_document`](../json_editable_document.md))
Only an **editable** document (`#!cpp view_mode::editable`, e.g. [`json_editable_document`](../json_editable_document.md))
has `set`; calling it on a read-only `basic_json_document` fails to compile (`#!cpp static_assert`).
1. Replaces the value `target` refers to with `value`.
@@ -3,7 +3,7 @@
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
template<typename BasicJsonType, bool Editable = false>
template<typename BasicJsonType, view_mode Mode = view_mode::read_only>
class basic_json_view;
```
@@ -37,7 +37,7 @@ Moving the document itself does not invalidate its views: the index is heap-allo
`#!cpp operator ValueType()`), and no `#!cpp get_ptr()` or `#!cpp get_ref()`; see [`get`](get.md).
`basic_json_view` itself is always read-only -- it never has a `set` or `push_back` of its own. A view of an
**editable** document (`#!cpp Editable == true`) sees every edit made through
**editable** document (`#!cpp view_mode::editable`) sees every edit made through
[`basic_json_document::set`](../basic_json_document/set.md) and
[`basic_json_document::push_back`](../basic_json_document/push_back.md): once a value is changed, every view that
still refers to it -- including ones taken before the change -- reads the new value. See
@@ -49,9 +49,10 @@ still refers to it -- including ones taken before the change -- reads the new va
: a specialization of [`basic_json`](../basic_json/index.md), matching the
[`basic_json_document`](../basic_json_document/index.md) the view was taken from.
`Editable`
: whether the view is of an editable document, matching the [`basic_json_document`](../basic_json_document/index.md)
it was taken from (optional, `#!cpp false` by default). See [Edits](../basic_json_document/index.md#edits).
`Mode`
: a [`view_mode`](../view_mode.md): whether the view is of an editable document, matching the
[`basic_json_document`](../basic_json_document/index.md) it was taken from (optional, `#!cpp view_mode::read_only` by
default). See [Edits](../basic_json_document/index.md#edits).
## Specializations
@@ -3,7 +3,7 @@
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
using json_editable_document = basic_json_document<json, true>;
using json_editable_document = basic_json_document<json, view_mode::editable>;
```
This type is an **editable** [`basic_json_document`](basic_json_document/index.md) of the default
+1 -1
View File
@@ -3,7 +3,7 @@
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
using json_editable_view = basic_json_view<json, true>;
using json_editable_view = basic_json_view<json, view_mode::editable>;
```
This type is a [`basic_json_view`](basic_json_view/index.md) of a value of a
-2
View File
@@ -43,8 +43,6 @@ header. See also the [macro overview page](../../features/macros.md).
- [**JSON_SKIP_UNSUPPORTED_COMPILER_CHECK**](json_skip_unsupported_compiler_check.md) - do not warn about unsupported compilers
- [**JSON_USE_GLOBAL_UDLS**](json_use_global_udls.md) - place user-defined string literals (UDLs) into the global namespace
- [**JSON_USE_SIMDUTF**](json_use_simdutf.md) - use the simdutf library to accelerate UTF-8 validation
- [**JSON_VIEW_NO_SIMD**](json_view_no_simd.md) - use only portable code in the parser of `json_view.hpp`
- [**JSON_VIEW_USE_SSSE3**](json_view_use_ssse3.md) - validate non-ASCII strings with SSSE3 in the parser of `json_view.hpp`
## Library version
+2 -2
View File
@@ -38,7 +38,7 @@ Therefore, assertions can be switched off by defining `NDEBUG`.
```cpp
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -64,7 +64,7 @@ Therefore, assertions can be switched off by defining `NDEBUG`.
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -79,7 +79,7 @@ The default value is `0` (disabled — existing behavior is preserved).
```cpp
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -98,7 +98,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#define JSON_BRACE_INIT_COPY_SEMANTICS 1
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -54,7 +54,7 @@ The default value is `0` (disabled, the deprecated functions can still be called
```cpp
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
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
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -39,7 +39,7 @@ The default value is `0`.
#define JSON_DISABLE_ENUM_SERIALIZATION 1
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
enum class Choice
{
@@ -66,7 +66,7 @@ The default value is `0`.
#define JSON_DISABLE_ENUM_SERIALIZATION 1
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
enum class Choice
{
@@ -99,7 +99,7 @@ The default value is `0`.
#define JSON_DISABLE_ENUM_SERIALIZATION 1
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
enum class Choice
{
@@ -92,7 +92,7 @@ The default value is `0`: streams are scanned in bulk.
#include <sstream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -115,7 +115,7 @@ The default value is `0`: streams are scanned in bulk.
#include <sstream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -72,7 +72,7 @@ The default value is `0` (disabled — existing behavior is preserved).
```cpp
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -89,7 +89,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#define JSON_DISABLE_TUPLE_REFERENCE_CONVERSION 1
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
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 <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
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 <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
+4 -2
View File
@@ -5,7 +5,8 @@
```
When defined, the library uses only portable C++ code where it would otherwise use vector instructions: when scanning
strings during parsing, and when writing floating-point numbers during serialization.
strings during parsing, and when writing floating-point numbers during serialization. This includes the parser of
[`basic_json_document`](../basic_json_document/index.md) (`<nlohmann/json_view.hpp>`).
The macro is an escape hatch, for example for toolchains that cannot compile the vector code, for sanitizers or
analyzers that do not understand it, or to compare the speed of both variants. It does not change any result: values,
@@ -61,7 +62,7 @@ By default, `#!cpp JSON_NO_SIMD` is not defined, and vector instructions are use
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -77,6 +78,7 @@ By default, `#!cpp JSON_NO_SIMD` is not defined, and vector instructions are use
- [**JSON_USE_SIMDUTF**](json_use_simdutf.md) - use the simdutf library to accelerate UTF-8 validation
- [**JSON_DISABLE_STREAM_BULK_SCAN**](json_disable_stream_bulk_scan.md) - read a `std::istream` one character at a time
- [Parsing: input sources and performance](../../features/parsing/index.md#input-sources-and-performance)
- [json_view](../../features/json_view.md) - the zero-copy view, whose parser the macro also affects
## Version history
@@ -94,7 +94,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <sstream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -115,7 +115,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <sstream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -64,7 +64,7 @@ The default value is `0` (disabled, the behavior of version 3.12.0 and earlier i
```cpp
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
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
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -92,7 +92,7 @@ The default value is `0` (disabled — existing behavior is preserved).
```cpp
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -109,7 +109,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#define JSON_STRICT_NUL_HANDLING 1
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -77,7 +77,7 @@ The default value is `0` (disabled — existing behavior is preserved).
#include <map>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
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 <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
enum TaskState { TS_STOPPED, TS_RUNNING, TS_COMPLETED };
@@ -1,52 +0,0 @@
# JSON_VIEW_NO_SIMD
```cpp
#define JSON_VIEW_NO_SIMD
```
When defined, the parser of [`basic_json_document`](../basic_json_document/index.md) (`<nlohmann/json_view.hpp>`)
uses only portable C++ to scan strings. By default, it scans long runs of string bytes 16 at a time with NEON on
AArch64 (with GCC and Clang) and SSE2 on x86-64, which are part of the baseline instruction sets of these
architectures, and validates non-ASCII text with NEON (or SSSE3, see
[`JSON_VIEW_USE_SSSE3`](json_view_use_ssse3.md)).
The same input is accepted or rejected either way, with the same values, and errors are reported the same way; only
the speed differs. The macro exists for platforms whose compilers lack the intrinsics headers, and to test the portable
code.
!!! note "ABI compatibility"
The macro selects between two definitions of the same inline functions. Whether it is defined is encoded in the
[namespace](../../features/namespace.md) (tag `_vns`), resulting in distinct symbol names. Translation units
compiled with and without it can therefore be linked into the same program without One Definition Rule (ODR)
violations, but they cannot exchange instances of library types.
## Default definition
By default, `#!cpp JSON_VIEW_NO_SIMD` is not defined, and the vector code is used where available.
```cpp
#undef JSON_VIEW_NO_SIMD
```
## Examples
??? example
The code below uses the portable string scanning of the view.
```cpp
#define JSON_VIEW_NO_SIMD
#include <nlohmann/json_view.hpp>
...
```
## See also
- [JSON_VIEW_USE_SSSE3](json_view_use_ssse3.md) - validate non-ASCII strings with SSSE3 on x86-64
- [json_view](../../features/json_view.md) - the zero-copy view
## Version history
- Added in version 3.13.0.
@@ -1,53 +0,0 @@
# JSON_VIEW_USE_SSSE3
```cpp
#define JSON_VIEW_USE_SSSE3
```
When defined on x86-64, the parser of [`basic_json_document`](../basic_json_document/index.md)
(`<nlohmann/json_view.hpp>`) validates non-ASCII text in strings with SSSE3 without asking the CPU first.
By default, the parser checks once at run time whether the CPU has SSSE3 (all x86-64 CPUs since about 2011 have it)
and then validates non-ASCII text 16 bytes at a time, using the "lookup4" algorithm of
[simdjson](https://github.com/simdjson/simdjson); on CPUs without SSSE3, it validates one UTF-8 sequence at a time.
The vector check is compiled for SSSE3 with a function attribute (GCC 4.9 and later, Clang), so this needs no compiler
option. With MSVC, the check uses `__cpuid`. On AArch64, the vector check uses NEON and is always on.
Define the macro only together with a compiler option that enables SSSE3 (e.g. `-mssse3`, or `-march=` with a CPU that
has it), and only for programs that run on such CPUs. It saves the check of the CPU, which costs little. The same
input is accepted or rejected either way; only the speed of non-ASCII text differs.
!!! note "ABI compatibility"
The macro selects between two definitions of the same inline functions. Whether it is defined is encoded in the
[namespace](../../features/namespace.md) (tag `_vssse3`, on every architecture), resulting in distinct symbol
names. Translation units compiled with and without it can therefore be linked into the same program without One
Definition Rule (ODR) violations, but they cannot exchange instances of library types.
## Default definition
By default, `#!cpp JSON_VIEW_USE_SSSE3` is not defined.
```cpp
#undef JSON_VIEW_USE_SSSE3
```
## Examples
??? example
With CMake, for a program that only runs on CPUs with SSSE3:
```cmake
target_compile_definitions(your_target PRIVATE JSON_VIEW_USE_SSSE3)
target_compile_options(your_target PRIVATE -mssse3)
```
## See also
- [JSON_VIEW_NO_SIMD](json_view_no_simd.md) - use only portable code in the view's parser
- [JSON_USE_SIMDUTF](json_use_simdutf.md) - validate UTF-8 with simdutf in `basic_json`'s parser
## Version history
- Added in version 3.13.0.
@@ -39,6 +39,6 @@ the library.
## Version history
- Added in version 3.11.0. Changed inline namespace name in version 3.11.2. Added the ABI tag `_dp` in
version 3.12.0, and the ABI tags `_bics`, `_psp`, `_snul`, `_sbu8`, `_ekmo`, `_dsbs`, `_dufio`, `_ns`, `_vns`,
and `_vssse3` in version 3.13.0; see
version 3.12.0, and the ABI tags `_bics`, `_psp`, `_snul`, `_sbu8`, `_ekmo`, `_dsbs`, `_dufio`, and `_ns` in
version 3.13.0; see
[`nlohmann` Namespace](../../features/namespace.md#structure).
@@ -3,7 +3,7 @@
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
using ordered_json_editable_document = basic_json_document<ordered_json, true>;
using ordered_json_editable_document = basic_json_document<ordered_json, view_mode::editable>;
```
This type is an **editable** [`basic_json_document`](basic_json_document/index.md) of the
@@ -3,7 +3,7 @@
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
using ordered_json_editable_view = basic_json_view<ordered_json, true>;
using ordered_json_editable_view = basic_json_view<ordered_json, view_mode::editable>;
```
This type is a [`basic_json_view`](basic_json_view/index.md) of a value of an
+80
View File
@@ -0,0 +1,80 @@
# <small>nlohmann::</small>view_mode
<small>Defined in header `<nlohmann/json_view.hpp>`</small>
```cpp
enum class view_mode : std::uint8_t
{
read_only,
editable
};
```
The second template parameter of [`basic_json_document`](basic_json_document/index.md) and
[`basic_json_view`](basic_json_view/index.md): whether a document can be changed after parsing, and whether a view is
of such a document.
`read_only`
: the default: the document is parsed once and then only read. It carries none of the bookkeeping edits need, and
calling [`set`](basic_json_document/set.md), [`push_back`](basic_json_document/push_back.md),
[`insert`](basic_json_document/insert.md), or [`erase`](basic_json_document/erase.md) on it fails to compile.
`editable`
: the document also offers [`set`](basic_json_document/set.md), [`push_back`](basic_json_document/push_back.md),
[`insert`](basic_json_document/insert.md), and [`erase`](basic_json_document/erase.md); its views see every edit,
see [Edits](basic_json_document/index.md#edits).
The shortcuts name both modes: [`json_document`](json_document.md) and [`json_view`](json_view.md) are read-only,
[`json_editable_document`](json_editable_document.md) and [`json_editable_view`](json_editable_view.md) are editable
(and likewise for `ordered_json`).
## Notes
The mode is part of the view's type, and there is no conversion between the two modes: a read-only view reads a
container in place, while a view of an editable document follows the links that edits leave behind. A function that
accepts views therefore names the modes it accepts in its signature:
```cpp
// views of editable documents only
template<typename BasicJsonType>
void f(basic_json_view<BasicJsonType, view_mode::editable> v);
// views of read-only documents only
template<typename BasicJsonType>
void f(basic_json_view<BasicJsonType, view_mode::read_only> v);
// either
template<typename BasicJsonType, view_mode Mode>
void f(basic_json_view<BasicJsonType, Mode> v);
```
A function that takes a [`json_view`](json_view.md) accepts neither an [`ordered_json_view`](ordered_json_view.md)
nor a [`json_editable_view`](json_editable_view.md). Views of the two modes still compare with
[`operator==`](basic_json_view/operator_eq.md).
## Examples
??? example
The example below shows a function template that accepts the views of both modes, and one that accepts only
views of editable documents.
```cpp
--8<-- "examples/view_mode.cpp"
```
Output:
```
--8<-- "examples/view_mode.output"
```
## See also
- [basic_json_document](basic_json_document/index.md) - a parsed JSON text
- [basic_json_view](basic_json_view/index.md) - a handle to one value of a document
- [json_editable_document](json_editable_document.md) - an editable document of `json`
## Version history
Added in 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 [Clang Static Analyzer](https://clang-analyzer.llvm.org) with 52 enabled
checkers.
- [x] The code is checked with the latest [Clang Static Analyzer](https://clang-analyzer.llvm.org) with 89 enabled
rules.
- [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 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
@@ -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 [Sanitizers](https://github.com/google/sanitizers) (address sanitizer, undefined
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
@@ -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.
- [x] Third-party code included in the repository for testing, such as [doctest](https://github.com/doctest/doctest),
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
@@ -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:
- CMake 3.5 (the earliest supported)
- CMake 3.31.6 (the latest 3.x release)
- CMake 4.0.0 (the first 4.x 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.
- CMake 4.0.0 (a very recent release)
-739
View File
@@ -1,739 +0,0 @@
/* nlohmann/json brand for Material for MkDocs (values from brand/kit/tokens.css) */
@font-face {
font-family: "Inter";
src: url("fonts/Inter.woff2") format("woff2");
font-weight: 100 900;
font-display: swap;
}
@font-face {
font-family: "Inter";
src: url("fonts/Inter-Italic.woff2") format("woff2");
font-style: italic;
font-weight: 100 900;
font-display: swap;
}
@font-face {
font-family: "JetBrains Mono";
src: url("fonts/JetBrainsMono.woff2") format("woff2");
font-weight: 100 800;
font-display: swap;
}
@font-face {
font-family: "JetBrains Mono";
src: url("fonts/JetBrainsMono-Italic.woff2") format("woff2");
font-style: italic;
font-weight: 400;
font-display: swap;
}
:root {
--md-text-font: "Inter";
--md-code-font: "JetBrains Mono";
}
/* light */
[data-md-color-scheme="default"] {
--nj-blue: #1747a6;
--nj-blue-deep: #10357d;
--nj-blue-soft: #eaf1fd;
--nj-band: #1747a6;
--nj-red: #d93a3f;
--nj-red-soft: #fdeced;
--nj-string: #b4322a;
--nj-comment: #646d7a;
--md-primary-fg-color: var(--nj-band);
--md-primary-fg-color--light: #1d55c4;
--md-primary-fg-color--dark: #10357d;
--md-accent-fg-color: var(--nj-blue-deep);
--md-accent-fg-color--transparent: rgba(23, 71, 166, .1);
--md-typeset-a-color: var(--nj-blue);
--md-default-fg-color: #0f1419;
--md-default-fg-color--light: #4a515c;
--md-default-fg-color--lighter: #8a919c;
--md-default-fg-color--lightest: #e3e6eb;
--md-typeset-color: #0f1419;
--md-code-bg-color: #f5f7fa;
--md-code-fg-color: #0f1419;
}
/* dark */
[data-md-color-scheme="slate"] {
--nj-blue: #7aa7f5;
--nj-blue-deep: #a9c6f8;
--nj-blue-soft: #16233b;
--nj-band: #173e8c;
--nj-red: #f06a6e;
--nj-red-soft: #3a1c1e;
--nj-string: #f08a7e;
--nj-comment: #8b929e;
--md-hue: 220;
--md-primary-fg-color: var(--nj-band);
--md-primary-fg-color--light: #163f93;
--md-primary-fg-color--dark: #0c2556;
--md-accent-fg-color: var(--nj-blue-deep);
--md-accent-fg-color--transparent: rgba(122, 167, 245, .12);
--md-typeset-a-color: var(--nj-blue);
--md-default-bg-color: #0f1218;
--md-default-fg-color: #f2f4f7;
--md-default-fg-color--light: #b3b9c4;
--md-default-fg-color--lighter: #7b828e;
--md-default-fg-color--lightest: #272c36;
--md-typeset-color: #f2f4f7;
--md-code-bg-color: #171b23;
--md-code-fg-color: #f2f4f7;
--md-footer-bg-color: #0b0e13;
--md-footer-bg-color--dark: #08090d;
}
/* syntax colours (all at least 4.5:1 on the code panel in both schemes) */
[data-md-color-scheme="default"] {
--nj-hl-keyword: #1747a6;
--nj-hl-type: #0d6e72;
--nj-hl-function: #6b3fb8;
--nj-hl-string: #23793a;
--nj-hl-escape: #0f5d2a;
--nj-hl-key: #10357d;
--nj-hl-number: #b04a07;
--nj-hl-preproc: #a3247a;
}
[data-md-color-scheme="slate"] {
--nj-hl-keyword: #7aa7f5;
--nj-hl-type: #4fd1c5;
--nj-hl-function: #c4a3ff;
--nj-hl-string: #7ed491;
--nj-hl-escape: #b2ecc0;
--nj-hl-key: #a9c6f8;
--nj-hl-number: #f5a65b;
--nj-hl-preproc: #f48fc8;
}
.md-typeset .highlight :is(.k, .kd, .kn, .kr, .kp, .kv, .ow) { color: var(--nj-hl-keyword); font-weight: 600; }
.md-typeset .highlight :is(.kt, .nc, .nn, .na) { color: var(--nj-hl-type); }
.md-typeset .highlight :is(.nf, .fm, .nb, .bp) { color: var(--nj-hl-function); }
.md-typeset .highlight :is(.s, .s1, .s2, .sb, .sc, .sd, .sh, .sx, .sr, .ss, .sa, .dl, .cpf) { color: var(--nj-hl-string); }
.md-typeset .highlight :is(.se, .si) { color: var(--nj-hl-escape); font-weight: 600; }
.md-typeset .highlight .nt { color: var(--nj-hl-key); }
.md-typeset .highlight :is(.m, .mi, .mf, .mh, .mo, .mb, .il, .kc) { color: var(--nj-hl-number); }
.md-typeset .highlight .kc { font-weight: 500; }
.md-typeset .highlight .cp { color: var(--nj-hl-preproc); }
.md-typeset .highlight :is(.c, .c1, .cm, .ch, .cs) { color: var(--nj-comment); font-style: italic; }
.md-typeset .highlight :is(.o, .p) { color: var(--md-default-fg-color--light); }
.md-typeset .highlight :is(.n, .nx, .nv, .no, .ni, .nl, .py) { color: var(--md-code-fg-color); }
.md-typeset .highlight .err { color: inherit; background: none; }
/* typography: Inter with cv11/ss03, bold headlines with negative tracking */
body {
font-feature-settings: "cv11", "ss03";
}
.md-typeset {
font-size: .85rem; /* 17 px body */
line-height: 1.65;
}
.md-typeset h1 {
color: var(--md-typeset-color);
font-weight: 800;
letter-spacing: -.035em;
line-height: 1.1;
}
.md-typeset h2 {
font-weight: 800;
letter-spacing: -.025em;
line-height: 1.15;
}
.md-typeset h3 {
font-weight: 700;
letter-spacing: -.015em;
}
.md-typeset table:not([class]) {
font-variant-numeric: tabular-nums;
}
/* header and tabs: one blue band with the faint syntax pattern; wordmark instead of the site name.
A veil over the tile keeps the glyphs from running through the navigation text; the hero shows the pattern at full strength. */
.md-header, .md-tabs {
--nj-veil: linear-gradient(color-mix(in srgb, var(--md-primary-fg-color) 62%, transparent), color-mix(in srgb, var(--md-primary-fg-color) 62%, transparent));
background-color: var(--md-primary-fg-color);
background-image: var(--nj-veil), url("pattern-on-blue.svg");
background-size: auto, 160px 160px;
background-position: 0 0, 0 0;
}
.md-tabs {
background-position: 0 0, 0 -48px; /* continue the header's tile */
}
.md-header__button.md-logo img {
width: auto;
height: 1.5rem;
}
.md-header__topic:first-child .md-ellipsis { /* the wordmark replaces the site name at every width */
display: none;
}
@media screen and (max-width: 76.234375em) { /* Material hides the header logo here: show the wordmark on phones, too */
.md-header__button.md-logo {
display: block;
margin: 0 0 0 .2rem;
padding: .4rem .2rem;
}
.md-header__button[for="__drawer"] {
order: -1;
}
}
.md-nav__button.md-logo img {
width: auto;
height: 1.4rem;
}
/* shapes: 6 px corners on blocks, 4 px on inline code */
.md-typeset pre > code, .md-typeset .highlight, .md-typeset .highlighttable,
.md-typeset .admonition, .md-typeset details, .md-typeset .tabbed-set,
.md-typeset .grid.cards > ul > li, .md-typeset .md-button {
border-radius: 6px;
}
.md-typeset code {
border-radius: 4px;
}
/* inline code: the font alone marks it, no grey box; linked code keeps the link colour */
.md-typeset :not(pre) > code {
padding: 0;
background-color: transparent;
box-shadow: none;
color: inherit;
font-size: .88em;
}
.md-typeset .highlight pre > code, .md-typeset .highlighttable {
border: 1px solid var(--md-default-fg-color--lightest);
}
/* callouts: 3 px left border; note/info/tip in blue on blue-soft, danger/bug in red on red-soft */
.md-typeset .admonition, .md-typeset details {
border-width: 0 0 0 3px;
box-shadow: none;
font-size: .8rem;
}
.md-typeset :is(.admonition, details):is(.note, .info, .tip, .abstract, .example, .question) {
border-color: var(--nj-blue);
background-color: var(--nj-blue-soft);
}
.md-typeset :is(.note, .info, .tip, .abstract, .example, .question) > :is(.admonition-title, summary) {
background-color: transparent;
}
.md-typeset :is(.note, .info, .tip, .abstract, .example, .question) > :is(.admonition-title, summary)::before {
background-color: var(--nj-blue);
}
.md-typeset :is(.admonition, details):is(.danger, .bug, .failure) {
border-color: var(--nj-red);
background-color: var(--nj-red-soft);
}
.md-typeset :is(.danger, .bug, .failure) > :is(.admonition-title, summary) {
background-color: transparent;
}
.md-typeset :is(.danger, .bug, .failure) > :is(.admonition-title, summary)::before {
background-color: var(--nj-red);
}
/* buttons */
.md-typeset .md-button--primary {
background-color: var(--nj-blue);
border-color: var(--nj-blue);
}
/* home page hero (overrides/home.html): blue band with the syntax pattern, headline, lead, buttons, code panel */
.nj-hero {
--nj-hero-to: #123a8a;
color: #fff;
background-color: var(--md-primary-fg-color);
background-image: url("pattern-on-blue.svg"), linear-gradient(160deg, var(--md-primary-fg-color), var(--nj-hero-to));
background-size: 160px 160px, auto;
background-position: 0 -96px, 0 0; /* continue the tile of header and tabs */
}
[data-md-color-scheme="slate"] .nj-hero {
--nj-hero-to: #0c2556;
}
.nj-hero__inner {
display: grid;
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
gap: 2.4rem;
align-items: center;
padding: 3rem .8rem 3.6rem;
}
.nj-hero__kicker {
display: inline-block;
margin: 0;
padding: .15rem .55rem;
border: 1px solid rgba(255, 255, 255, .35);
border-radius: 4px;
color: #bcd3fb;
font-family: var(--md-code-font-family);
font-size: .65rem; /* 13 px */
font-weight: 500;
letter-spacing: .02em;
}
.nj-hero__title {
margin: 0 0 .8rem;
color: #fff;
font-size: clamp(1.7rem, 4.2vw, 3.2rem); /* 34-64 px */
font-weight: 800;
line-height: 1.02;
letter-spacing: -.035em;
}
.nj-hero__title span {
color: #bcd3fb;
}
.nj-hero__lead {
max-width: 22em;
margin: 0 0 2rem;
color: rgba(255, 255, 255, .9);
font-size: clamp(1.1rem, 2.2vw, 1.6rem); /* 22-32 px */
font-style: italic;
font-weight: 500;
line-height: 1.35;
letter-spacing: -.015em;
}
.nj-hero__actions {
display: flex;
flex-wrap: wrap;
gap: .6rem;
margin: 0;
}
.nj-hero .md-button.nj-hero__button {
margin: 0;
padding: .55em 1.3em;
border: 1px solid rgba(255, 255, 255, .6);
border-radius: 6px;
color: #fff;
font-size: .75rem;
font-weight: 600;
}
.nj-hero .md-button--primary.nj-hero__button {
border-color: #fff;
background-color: #fff;
color: var(--md-primary-fg-color);
}
.nj-hero .md-button.nj-hero__button:is(:hover, :focus) {
border-color: #fff;
background-color: rgba(255, 255, 255, .12);
color: #fff;
}
.nj-hero .md-button--primary.nj-hero__button:is(:hover, :focus) {
background-color: #eaf1fd;
color: var(--md-primary-fg-color);
}
.nj-hero__code {
border-radius: 6px;
background-color: var(--md-code-bg-color);
box-shadow: 0 12px 32px rgba(5, 18, 48, .35);
}
.nj-hero__code pre {
margin: 0;
padding: 1.1rem 1.3rem;
overflow-x: auto;
color: var(--md-code-fg-color);
font-family: var(--md-code-font-family);
font-size: .7rem; /* 14 px */
line-height: 1.7;
}
.nj-hero__code .nj-k { color: var(--nj-hl-type); }
.nj-hero__code .nj-s { color: var(--nj-hl-string); }
.nj-hero__code .nj-n { color: var(--nj-hl-number); }
.nj-hero__code .nj-c { color: var(--nj-comment); font-style: italic; }
@media screen and (max-width: 59.984375em) {
.nj-hero__inner {
grid-template-columns: minmax(0, 1fr);
gap: 1.8rem;
padding: 2rem .8rem 2.4rem;
}
}
@media screen and (max-width: 29.984375em) {
.nj-hero__code pre {
font-size: .6rem;
}
}
/* the hero carries the headline: keep the page's h1 for the title and screen readers only */
body:has(.nj-hero) .md-content__inner > h1 {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
}
/* cards: 1 px line border, 6 px corners, blue icon on soft blue, blue border on hover */
.md-typeset .grid.cards > ul > li {
padding: 1rem 1.1rem;
border: 1px solid var(--md-default-fg-color--lightest);
background-color: var(--md-default-bg-color);
transition: border-color 150ms, box-shadow 150ms, transform 150ms;
}
.md-typeset .grid.cards > ul > li:is(:hover, :focus-within) {
border-color: var(--nj-blue);
box-shadow: 0 6px 18px rgba(23, 71, 166, .12);
transform: translateY(-1px);
}
.md-typeset .grid.cards > ul > li > hr {
display: none;
}
.md-typeset .grid.cards .twemoji.lg {
box-sizing: content-box;
margin-right: .5rem;
padding: .3rem;
border-radius: 6px;
background-color: var(--nj-blue-soft);
color: var(--nj-blue);
}
.md-typeset .grid.cards > ul > li > p:first-child strong {
font-size: .9rem;
font-weight: 700;
letter-spacing: -.01em;
}
.md-typeset .grid.cards > ul > li > p:last-child a {
font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
.md-typeset .grid.cards > ul > li { transition: none; transform: none !important; }
}
/* home page: no table of contents, so keep the text at reading width and the cards in three columns */
body:has(.nj-hero) .md-content {
max-width: 58rem;
margin: 0 auto;
}
@media screen and (min-width: 60em) {
body:has(.nj-hero) .md-typeset .grid.cards {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
/* lists: Material's indent, bullets as small blue squares, numbers in the secondary text colour */
.md-typeset ul:not(.task-list, .md-annotation-list) > li {
position: relative;
list-style: none;
}
.md-typeset ul:not(.task-list, .md-annotation-list) > li::before {
content: "";
position: absolute;
top: .65em; /* middle of the first line at line-height 1.65 */
left: -.95em;
width: .36em;
height: .36em;
background-color: var(--nj-blue);
}
.md-typeset ol > li::marker {
color: var(--md-default-fg-color--light);
font-variant-numeric: tabular-nums;
}
.md-typeset .grid.cards > ul > li::before {
display: none;
}
/* wider page: Material's grid stops at 61rem (1220 px) */
.md-grid {
max-width: 72rem; /* 1440 px */
}
/* tables: full width, 1 px line border with 6 px corners, header row on the panel colour, 15 px text */
.md-typeset__table {
display: block; /* Material: inline-block, so tables only grow to their content */
}
.md-typeset table:not([class]) {
display: table;
width: 100%;
border: 1px solid var(--md-default-fg-color--lightest);
border-radius: 6px;
font-size: .75rem;
line-height: 1.55;
}
.md-typeset table:not([class]) th {
padding: .65em 1em;
border-bottom: 1px solid var(--md-default-fg-color--lightest);
background-color: var(--md-code-bg-color);
color: var(--md-typeset-color);
font-weight: 600;
vertical-align: bottom;
}
.md-typeset table:not([class]) th:first-child { border-top-left-radius: 5px; }
.md-typeset table:not([class]) th:last-child { border-top-right-radius: 5px; }
.md-typeset table:not([class]) td {
padding: .65em 1em;
border-top: 1px solid var(--md-default-fg-color--lightest);
}
.md-typeset table:not([class]) tbody tr:first-child td {
border-top: 0;
}
.md-typeset table:not([class]) tbody tr:hover {
background-color: var(--nj-blue-soft);
box-shadow: none;
}
.md-typeset table:not([class]) td code {
white-space: nowrap;
}
/* numbers and header code stay on one line; a table wider than the screen scrolls sideways instead */
.md-typeset table:not([class]) :is(td, th):is([align="right"], [style*="right"]),
.md-typeset table:not([class]) th code {
white-space: nowrap;
}
@media screen and (max-width: 44.984375em) {
.md-typeset table:not([class]) {
font-size: .7rem;
}
.md-typeset table:not([class]) :is(th, td) {
padding: .55em .75em;
}
}
/* more room before headings (Material: h2 1.6em, h3 1.6em, h4-h6 1-1.25em) and at the end of each page (1.2rem) */
.md-typeset h2 { margin-top: 2.4em; }
.md-typeset h3 { margin-top: 2.2em; }
.md-typeset h2 + h3 { margin-top: .8em; }
.md-typeset :is(h4, h5, h6) { margin-top: 1.8em; }
.md-content__inner {
margin-bottom: 4.8rem; /* 96 px */
}
/* Mermaid diagrams: white boxes with a blue outline, grey lines, Inter; shapes and spacing in js/mermaid-brand.js */
:root > * {
--md-mermaid-font-family: var(--md-text-font-family), sans-serif;
--md-mermaid-edge-color: var(--md-default-fg-color--lighter);
--md-mermaid-node-bg-color: var(--md-default-bg-color);
--md-mermaid-node-fg-color: var(--nj-blue);
--md-mermaid-label-bg-color: var(--md-default-bg-color);
--md-mermaid-label-fg-color: var(--md-default-fg-color);
--md-mermaid-sequence-actor-bg-color: var(--nj-blue-soft);
--md-mermaid-sequence-actor-line-color: var(--md-default-fg-color--lighter);
--md-mermaid-sequence-note-bg-color: var(--md-code-bg-color);
--md-mermaid-sequence-note-border-color: var(--md-default-fg-color--lightest);
--md-mermaid-sequence-number-fg-color: #fff;
}
/* a diagram wider than the column scrolls sideways (js/mermaid-brand.js stops shrinking it at 80 %) */
.md-typeset .mermaid {
overflow-x: auto;
}
/* ---- polish pass ---- */
/* header: a search field that reads as a field on the band, tabs with an active marker, readable GitHub facts */
.md-header .md-search__form {
border: 1px solid rgba(255, 255, 255, .22);
border-radius: 6px;
background-color: rgba(255, 255, 255, .12);
transition: background-color 150ms, border-color 150ms;
}
.md-header .md-search__form:hover {
border-color: rgba(255, 255, 255, .4);
background-color: rgba(255, 255, 255, .2);
}
.md-search__output {
border-radius: 0 0 6px 6px;
box-shadow: 0 16px 40px rgba(5, 18, 48, .28);
}
.md-search-result__link:focus-visible, .md-search-result__more summary:focus-visible {
outline: 2px solid var(--nj-blue);
outline-offset: -2px;
}
.md-tabs__link {
font-size: .72rem;
font-weight: 500;
opacity: .85;
}
.md-tabs__item--active .md-tabs__link, .md-tabs__link:hover {
opacity: 1;
}
.md-tabs__item--active {
box-shadow: inset 0 -2px 0 #fff;
}
.md-source__facts {
font-size: .62rem;
}
/* footer: deep brand blue instead of neutral black (the dark scheme keeps its own near-black) */
[data-md-color-scheme="default"] {
--md-footer-bg-color: #0d2a66;
--md-footer-bg-color--dark: #0a2152;
}
.md-footer-meta .md-copyright, .md-footer-meta .md-copyright a {
color: rgba(255, 255, 255, .72);
}
.md-footer__link {
border-radius: 6px;
transition: background-color 150ms;
}
.md-footer__link:is(:hover, :focus-visible) {
background-color: rgba(255, 255, 255, .08);
}
/* page title: tighter to the first paragraph; page actions (view/edit source) stay in the background */
.md-typeset h1 {
margin-bottom: 1rem;
}
.md-content__button {
opacity: .55;
transition: opacity 150ms;
}
.md-content__button:is(:hover, :focus-visible) {
opacity: 1;
}
body:has(.nj-hero) .md-content__button {
display: none;
}
/* sidebars: bold marker for the current page, rail and marker for the table of contents */
.md-nav__link--active {
font-weight: 600;
}
.md-nav--secondary > .md-nav__list {
margin-left: -.1rem;
border-left: 1px solid color-mix(in srgb, var(--md-default-fg-color) 16%, transparent);
}
.md-nav--secondary .md-nav__link {
margin-left: -1px;
padding-left: .6rem;
border-left: 2px solid transparent;
}
.md-nav--secondary .md-nav__link--active {
border-left-color: var(--nj-blue);
color: var(--nj-blue);
}
.md-nav--secondary .md-nav__list .md-nav__list {
padding-left: .6rem;
}
.md-nav--secondary .md-nav__title {
font-size: .64rem;
letter-spacing: .04em;
text-transform: uppercase;
}
/* keyboard focus: one visible ring in the brand blue */
.md-typeset a:focus-visible, .md-typeset .md-button:focus-visible, .md-typeset summary:focus-visible,
.md-nav__link:focus-visible, .md-tabs__link:focus-visible, .md-top:focus-visible {
outline: 2px solid var(--nj-blue);
outline-offset: 2px;
border-radius: 3px;
}
.md-header :is(a, button, label):focus-visible, .nj-hero a:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
}
/* inline code must not stretch the line box (JetBrains Mono has tall metrics), abbreviations stay quiet */
.md-typeset :not(pre) > code {
line-height: 1;
}
.md-typeset abbr {
border-bottom-color: var(--md-default-fg-color--lighter);
}
.md-typeset :is(h1, h2, h3, h4, a, .grid.cards > ul > li > p:first-child) abbr {
border-bottom-color: transparent;
}
/* number railroad diagram: inline SVG (docs/images/json_syntax_number.svg), follows the colour scheme */
.md-typeset .railroad-wrap, .md-typeset .nj-fig-wrap {
overflow-x: auto;
margin: 1.5rem 0;
}
.md-typeset svg.railroad {
display: block;
width: 100%;
min-width: 36rem;
max-width: 52rem;
margin-inline: auto;
color: var(--md-default-fg-color);
font-family: var(--md-text-font-family), sans-serif;
}
.railroad .rr-t { fill: color-mix(in srgb, var(--md-typeset-a-color) 10%, transparent); stroke: var(--md-typeset-a-color); stroke-width: 2; }
.railroad .rr-track, .railroad .rr-n { stroke: color-mix(in srgb, currentColor 60%, var(--md-default-bg-color)); stroke-opacity: 1; } /* opaque, so overlapping segments do not darken */
.railroad .rr-n { fill: color-mix(in srgb, currentColor 6%, transparent); stroke-width: 2; }
.railroad .rr-bg { fill: var(--md-default-bg-color); }
.railroad .rr-arrow { fill: currentColor; fill-opacity: .6; }
.railroad text { fill: currentColor; text-anchor: middle; }
.railroad .rr-c { font-family: var(--md-code-font-family), monospace; font-size: 16px; font-weight: 500; }
.railroad .rr-b { font-size: 14.5px; font-weight: 500; }
.railroad .rr-l { font-size: 14px; text-anchor: start; fill-opacity: .6; }
.railroad .rr-name { font-size: 17px; font-weight: 700; fill-opacity: 1; }
/* figures drawn as inline SVG (docs/images/callback_events.svg, range-*.svg): they follow the colour scheme */
.md-typeset svg.nj-fig {
display: block;
width: 100%;
height: auto;
margin-inline: auto;
color: var(--md-default-fg-color);
font-family: var(--md-text-font-family), sans-serif;
}
.md-typeset svg.nj-fig--range { min-width: 30rem; max-width: 40rem; }
.md-typeset svg.nj-fig--cb { max-width: 30rem; }
.nj-fig { --fg-line: color-mix(in srgb, currentColor 55%, var(--md-default-bg-color)); }
.nj-fig .fg-cell { fill: color-mix(in srgb, var(--md-typeset-a-color) 14%, var(--md-default-bg-color)); stroke: var(--fg-line); stroke-width: 1.5; }
.nj-fig .fg-cell--end { fill: none; stroke-dasharray: 4 3; }
.nj-fig .fg-pill { fill: color-mix(in srgb, var(--md-typeset-a-color) 10%, var(--md-default-bg-color)); stroke: var(--md-typeset-a-color); stroke-width: 1.5; }
.nj-fig .fg-pilltext { fill: var(--md-typeset-a-color); font-family: var(--md-code-font-family), monospace; font-size: 14px; font-weight: 500; text-anchor: middle; }
.nj-fig .fg-arrow { stroke: var(--fg-line); stroke-width: 1.5; fill: none; }
.nj-fig .fg-arrow--dash { stroke-dasharray: 3 3; }
.nj-fig .fg-head { fill: var(--fg-line); }
.nj-fig .fg-note { fill: currentColor; fill-opacity: .7; font-size: 13.5px; text-anchor: middle; }
.nj-fig .fg-note--r { text-anchor: end; }
.nj-fig .fg-note--l { text-anchor: start; }
.nj-fig .fg-h { fill: currentColor; fill-opacity: .7; font-size: 15px; font-weight: 600; }
.nj-fig .fg-code { fill: currentColor; font-family: var(--md-code-font-family), monospace; font-size: 16px; white-space: pre; }
.nj-fig .fg-leg { font-size: 15px; }
.nj-fig { --cb-os: #4eb05a; --cb-oe: #1a6b34; --cb-k: #e5534b; --cb-as: #f0c000; --cb-ae: #b07d00; --cb-v: #1f6fd1; }
[data-md-color-scheme="slate"] .nj-fig { --cb-os: #7ee787; --cb-oe: #2ea043; --cb-k: #ff7b72; --cb-as: #f2cc60; --cb-ae: #c69026; --cb-v: #58a6ff; }
.nj-fig .cb-os { fill: var(--cb-os); }
.nj-fig .cb-oe { fill: var(--cb-oe); }
.nj-fig .cb-k { fill: var(--cb-k); }
.nj-fig .cb-as { fill: var(--cb-as); }
.nj-fig .cb-ae { fill: var(--cb-ae); }
.nj-fig .cb-v { fill: var(--cb-v); }
.md-typeset img[src*="json-light"], .md-typeset img[src*="json-dark"] {
border-radius: 8px;
}
.md-typeset img {
max-width: 100%;
height: auto;
}
/* home page: content uses the same column as every other page */
body:has(.nj-hero) .md-content {
max-width: none;
margin: 0;
}
.md-typeset .grid.cards {
width: auto;
}
/* 404 page (overrides/404.html) */
.nj-404 {
max-width: 30rem;
padding: 2rem 0 3rem;
}
.nj-404__code {
margin: 0 0 .4rem;
color: var(--nj-blue);
font-family: var(--md-code-font-family);
font-size: .8rem;
font-weight: 500;
}
.md-typeset .nj-404 h1 {
margin-bottom: .8rem;
}
.nj-404 .md-button {
margin: .4rem .4rem 0 0;
}
/* touch targets and phones */
@media screen and (max-width: 59.984375em) {
.md-nav__link {
padding-block: .2rem;
}
}
@media screen and (max-width: 29.984375em) {
.md-typeset h1 {
font-size: 1.7em;
}
.md-typeset .highlight pre > code {
font-size: .68rem;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><g font-family='Menlo,monospace' font-size='26' font-weight='600' fill='#ffffff' fill-opacity='0.10'><text x='14' y='34'>{</text><text x='92' y='22'>]</text><text x='136' y='60'>:</text><text x='52' y='82'>[</text><text x='118' y='112'>,</text><text x='20' y='140'>}</text><text x='78' y='150'>:</text><text x='140' y='158'>{</text></g></svg>

Before

Width:  |  Height:  |  Size: 408 B

+1 -1
View File
@@ -2,7 +2,7 @@
#include <iomanip>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -2,7 +2,7 @@
#include <vector>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
+3 -3
View File
@@ -2,19 +2,19 @@
#include <iomanip>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
// a valid JSON text
const auto* valid_text = R"(
auto valid_text = R"(
{
"numbers": [1, 2, 3]
}
)";
// an invalid JSON text
const auto* invalid_text = R"(
auto invalid_text = R"(
{
"strings": ["extra", "comma", ]
}
@@ -2,7 +2,7 @@
#include <string>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
+1 -1
View File
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
+2 -2
View File
@@ -2,9 +2,9 @@
#include <iomanip>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
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 <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
@@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
+1 -1
View File
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
+1 -1
View File
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,8 +1,8 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using nlohmann::ordered_json;
using json = nlohmann::json;
using ordered_json = nlohmann::ordered_json;
int main()
{
@@ -8,7 +8,7 @@
#include <valarray>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json.hpp>
using nlohmann::json;
using json = nlohmann::json;
int main()
{
@@ -2,7 +2,7 @@
#include <nlohmann/json.hpp>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -2,7 +2,7 @@
#include <utility>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,9 +1,9 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json;
using nlohmann::json_editable_document;
using nlohmann::json_editable_view;
using json = nlohmann::json;
using json_editable_document = nlohmann::json_editable_document;
using json_editable_view = nlohmann::json_editable_view;
int main()
{
@@ -1,9 +1,9 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json;
using nlohmann::json_editable_document;
using nlohmann::json_editable_view;
using json = nlohmann::json;
using json_editable_document = nlohmann::json_editable_document;
using json_editable_view = nlohmann::json_editable_view;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -4,8 +4,8 @@
#include <vector>
#include <nlohmann/json_view.hpp>
using nlohmann::json;
using nlohmann::json_document;
using json = nlohmann::json;
using json_document = nlohmann::json_document;
using image_check = json_document::image_check;
int main()
@@ -2,7 +2,7 @@
#include <string>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -2,7 +2,7 @@
#include <string>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -3,7 +3,7 @@
#include <nlohmann/json.hpp>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
json_document parse_from_temporary_buffer()
{
@@ -2,7 +2,7 @@
#include <vector>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,8 +1,8 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json;
using nlohmann::json_editable_document;
using json = nlohmann::json;
using json_editable_document = nlohmann::json_editable_document;
int main()
{
@@ -3,7 +3,7 @@
#include <vector>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,7 +1,7 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -4,7 +4,7 @@
#include <vector>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,9 +1,9 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json;
using nlohmann::json_editable_document;
using nlohmann::json_editable_view;
using json = nlohmann::json;
using json_editable_document = nlohmann::json_editable_document;
using json_editable_view = nlohmann::json_editable_view;
int main()
{
@@ -3,7 +3,7 @@
#include <string>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -2,7 +2,7 @@
#include <string>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using json_document = nlohmann::json_document;
int main()
{
@@ -1,8 +1,8 @@
#include <iostream>
#include <nlohmann/json_view.hpp>
using nlohmann::json_document;
using nlohmann::json_view;
using json_document = nlohmann::json_document;
using json_view = nlohmann::json_view;
int main()
{
Loaded 100 of 510 files, more files were not shown because too many files have changed in this diff. Show more