mirror of
https://github.com/nlohmann/json.git
synced 2026-11-13 23:45:23 +00:00
Split the json_view feature page into sub-pages (#6018)
* Split the json_view feature page into sub-pages
The single features/json_view.md page grew to ~600 lines covering eight
topics. Split it into features/json_view/ with an overview page and
pages for ownership and lifetime, differences from basic_json, reading
values, generic code, editing, and images.
The new differences page collects what was spread over several sections
("What is the same", "What is different", "Duplicate keys", and notes in
the conversion and serialization sections) under one summary table, and
adds the parts of the basic_json interface a view does not have. The
other pages now link to it instead of restating the rules.
Internal links across the documentation point to the new pages.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
* Docs: fix stale comments and trim repeated text in json_view pages
- fig-jsonview.js/.css: point the header comments at the new pages
- reading.md: views' strings are valid as long as the document (and a
borrowed source text), as lifetime.md says
- reading.md, generic_code.md: link to differences.md instead of
restating the member-order and repeated-key rules
- differences.md: drop the third mention of ordering comparisons, name
rbegin()/rend() in the iterator row
- exceptions.md: link editable documents to editing.md
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
---------
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 parent
7757de3a58
commit
6a852ab96d
73 files changed
+880
-686
No files matched your search
@@ -56,7 +56,7 @@ The public headers are in [`include/nlohmann`](https://github.com/nlohmann/json/
|
||||
- [`json_view.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/json_view.hpp) is a separate,
|
||||
optional header that defines [`basic_json_document`](../api/basic_json_document/index.md) and
|
||||
[`basic_json_view`](../api/basic_json_view/index.md), a flat-index, read-only, non-owning way to look at a parsed
|
||||
JSON text; see [Zero-copy JSON views](../features/json_view.md). It builds on `json.hpp` internals (it requires the
|
||||
JSON text; see [Zero-copy JSON views](../features/json_view/index.md). It builds on `json.hpp` internals (it requires the
|
||||
same library version) and has its own `detail/view/` subdirectory.
|
||||
|
||||
Everything else lives in [`detail/`](https://github.com/nlohmann/json/tree/develop/include/nlohmann/detail) and namespace `nlohmann::detail`, which is not part of the public API. Paths
|
||||
@@ -175,7 +175,7 @@ maintains the invariant that the pointer matching `m_type` is never null; `asser
|
||||
|
||||
## Node index of JSON views
|
||||
|
||||
A [`basic_json_document`](../api/basic_json_document/index.md) (see [Zero-copy JSON views](../features/json_view.md))
|
||||
A [`basic_json_document`](../api/basic_json_document/index.md) (see [Zero-copy JSON views](../features/json_view/index.md))
|
||||
does not build a tree of values. Its parser
|
||||
([`detail/view/builder.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/detail/view/builder.hpp))
|
||||
writes a flat array of 16-byte nodes, one per value and one per object key, in document order. A
|
||||
@@ -466,7 +466,7 @@ release. Besides the components above, it contains:
|
||||
- [`adl_serializer`](../api/adl_serializer/index.md) - customization point for type conversions
|
||||
- [`json_sax`](../api/json_sax/index.md) - interface of the SAX parser events
|
||||
- [SAX Interface](../features/parsing/sax_interface.md) - how to consume parser events without building a DOM
|
||||
- [Zero-copy JSON views](../features/json_view.md) - the flat node index that backs views and documents
|
||||
- [Zero-copy JSON views](../features/json_view/index.md) - the flat node index that backs views and documents
|
||||
- [Template Parameter Requirements](../features/types/template_parameters.md) - the template parameters of basic_json
|
||||
- [Serialization](../features/serialization.md) - the output side of the library
|
||||
- [`nlohmann` Namespace](../features/namespace.md) - how the library namespace is structured
|
||||
@@ -438,7 +438,7 @@ A UBJSON or BJData high-precision number could not be parsed.
|
||||
### json.exception.parse_error.116
|
||||
|
||||
[`basic_json_document::load()`](../api/basic_json_document/load.md) rejected an
|
||||
[image](../features/json_view.md#images): either the bytes are not one [`save()`](../api/basic_json_document/save.md)
|
||||
[image](../features/json_view/images.md): either the bytes are not one [`save()`](../api/basic_json_document/save.md)
|
||||
could have written (too short, an unknown magic number or format version, or sizes that do not fit the buffer), or
|
||||
they are, but fail the requested [`image_check`](../api/basic_json_document/load.md#image_check).
|
||||
|
||||
@@ -450,7 +450,7 @@ they are, but fail the requested [`image_check`](../api/basic_json_document/load
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view.md#images).
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view/images.md).
|
||||
|
||||
## Iterator errors
|
||||
|
||||
@@ -889,12 +889,12 @@ from JSON text.
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with editable [`json_document`s](../features/json_view.md).
|
||||
This exception was added in version 3.13.0, together with editable [`json_document`s](../features/json_view/editing.md).
|
||||
|
||||
### json.exception.type_error.320
|
||||
|
||||
[`basic_json_document::save()`](../api/basic_json_document/save.md) cannot write an
|
||||
[image](../features/json_view.md#images) of a [discarded](../api/basic_json_document/is_discarded.md) document.
|
||||
[image](../features/json_view/images.md) of a [discarded](../api/basic_json_document/is_discarded.md) document.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -904,7 +904,7 @@ from JSON text.
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view.md#images).
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view/images.md).
|
||||
|
||||
### json.exception.type_error.321
|
||||
|
||||
@@ -1192,7 +1192,7 @@ so they do not support an input of 4294967280 bytes (4 GiB minus 16 bytes) or mo
|
||||
storage: [`set`](../api/basic_json_document/set.md) and [`push_back`](../api/basic_json_document/push_back.md) throw
|
||||
this exception once the strings and number tokens written by edits reach 4 GiB in total, or once more than
|
||||
4294967295 arrays/objects have had an element set or appended to them. The same limit applies to an
|
||||
[image](../features/json_view.md#images): [`save()`](../api/basic_json_document/save.md) throws it if the node
|
||||
[image](../features/json_view/images.md): [`save()`](../api/basic_json_document/save.md) throws it if the node
|
||||
count, the text, or the decoded strings it would write would individually reach 4 GiB.
|
||||
|
||||
!!! failure "Example messages"
|
||||
@@ -1209,7 +1209,7 @@ count, the text, or the decoded strings it would write would individually reach
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with [`<nlohmann/json_view.hpp>`](../features/json_view.md).
|
||||
This exception was added in version 3.13.0, together with [`<nlohmann/json_view.hpp>`](../features/json_view/index.md).
|
||||
[`basic_json::parse()`](../api/basic_json/parse.md) has no such limit.
|
||||
|
||||
## Further exceptions
|
||||
|
||||
@@ -140,7 +140,7 @@ Read newline-delimited input line by line ([JSON Lines](../features/parsing/json
|
||||
|
||||
Handle and discard the records of a large array with a [parser callback](../features/parsing/parser_callbacks.md), stop
|
||||
early with the [SAX interface](../features/parsing/sax_interface.md), or read parts of the text through a
|
||||
[`json_document`](../features/json_view.md) (added in version 3.13.0). See
|
||||
[`json_document`](../features/json_view/index.md) (added in version 3.13.0). See
|
||||
[Input too large for memory](../features/parsing/large_and_partial_input.md#input-too-large-for-memory).
|
||||
|
||||
### Position of a parse error
|
||||
|
||||
Reference in new issue
Block a user