Document the node index of json_view on the architecture page

A new section describes the 16-byte node: its fields, how integers,
floats, and object members are stored, how views navigate without
pointers, and a worked example. The feature page and the pages of
basic_json_document and node_count link to it where they mention the
16 bytes.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-09-30 20:58:48 +02:00
parent 20d0723b67
commit d9a71e7bc5
4 changed files with 79 additions and 9 deletions
@@ -7,9 +7,10 @@ template<typename BasicJsonType>
class basic_json_document;
```
A parsed JSON text, held as a flat index of its values (16 bytes per value) instead of a tree of `BasicJsonType`
values. Strings and numbers stay in the source text; only strings that 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
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.
Strings and numbers stay in the source text; only strings that 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
`basic_json_document`; [`materialize()`](../basic_json_view/materialize.md) turns a subtree back into the
`BasicJsonType` value that [`BasicJsonType::parse()`](../basic_json/parse.md) would have produced for it.
@@ -21,8 +21,9 @@ Constant.
## Notes
Each index entry is 16 bytes, so `#!cpp node_count() * 16` is the size of the index itself (part, but not all, of
[`memory_usage()`](memory_usage.md), which also counts decoded strings and, for an owned document, the text).
Each index entry is [16 bytes](../../home/architecture.md#node-index-of-json-views), so `#!cpp node_count() * 16` is
the size of the index itself (part, but not all, of [`memory_usage()`](memory_usage.md), which also counts decoded
strings and, for an owned document, the text).
## Examples