mirror of
https://github.com/nlohmann/json.git
synced 2026-10-16 19:18:12 +00:00
Say that json_view converts integers while parsing
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+5
-4
No files matched your search
@@ -16,8 +16,9 @@ most of the resulting tree is thrown away almost immediately.
|
||||
[`basic_json_document::parse()`](../api/basic_json_document/parse.md) parses the same JSON grammar, with the same
|
||||
options, but instead of a tree it builds a flat index of the values it found: one
|
||||
[16-byte entry](../home/architecture.md#node-index-of-json-views) per value (and one per object key), in document
|
||||
order. Strings and numbers are referenced in place in the source text; only strings that contain escape sequences
|
||||
are decoded, into one shared buffer owned by the document.
|
||||
order. Integers are converted while parsing and stored in their entry. Floating-point numbers and strings are
|
||||
referenced in place in the source text: a float is converted when it is read, and only strings that contain escape
|
||||
sequences are decoded, into one shared buffer owned by the document.
|
||||
|
||||
[`basic_json_view`](../api/basic_json_view/index.md) is a small, trivially copyable handle (two pointers) into that
|
||||
index. It gives you the read-only, type-inspection part of the `basic_json` interface --
|
||||
|
||||
@@ -65,8 +65,8 @@ a DOM, three alternatives avoid building it:
|
||||
unparsed remainder of the input) instead of the whole document -- see the [recipe for streaming a large homogeneous
|
||||
array](parsing/parser_callbacks.md#recipe-streaming-a-large-homogeneous-array).
|
||||
- Parse into a [`json_document`](json_view.md) (`#!cpp <nlohmann/json_view.hpp>`) instead of a `basic_json`. It keeps
|
||||
the input text and builds a flat index of 16 bytes per value; strings and numbers are not copied, but read from the
|
||||
text when needed. Read-only [views](../api/basic_json_view/index.md) give the familiar element access, and only the
|
||||
the input text and builds a flat index of 16 bytes per value; strings and floating-point numbers are not copied, but
|
||||
read from the text when needed. Read-only [views](../api/basic_json_view/index.md) give the familiar element access, and only the
|
||||
parts you [`materialize()`](../api/basic_json_view/materialize.md) become `basic_json` values. A document that
|
||||
borrows the text instead of owning a copy needs the text to outlive it; see
|
||||
[choosing between `json`, the SAX interface, and `json_view`](json_view.md#choosing-between-json-ordered_json-the-sax-interface-and-json_view).
|
||||
|
||||
Reference in new issue
Block a user