mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
deploy: 63c10a51fc
This commit is contained in:
@@ -35,6 +35,12 @@ It is safe to move the passed binary value.
|
||||
--8<-- "examples/sax_parse__binary.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
- [SAX Interface](../../features/parsing/sax_interface.md) - the SAX interface article
|
||||
- [Binary Values](../../features/binary_values.md) - the article on binary values
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.8.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -149,6 +149,12 @@ binary(val=[...])
|
||||
result: true
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
- [SAX Interface](https://json.nlohmann.me/features/parsing/sax_interface/index.md) - the SAX interface article
|
||||
- [Binary Values](https://json.nlohmann.me/features/binary_values/index.md) - the article on binary values
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.8.0.
|
||||
|
||||
@@ -31,6 +31,11 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
- [SAX Interface](../../features/parsing/sax_interface.md) - the SAX interface article
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -196,6 +196,11 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
- [SAX Interface](https://json.nlohmann.me/features/parsing/sax_interface/index.md) - the SAX interface article
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -26,6 +26,11 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [start_array](start_array.md) - the beginning of an array was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -192,6 +192,11 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [start_array](https://json.nlohmann.me/api/json_sax/start_array/index.md) - the beginning of an array was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -26,6 +26,12 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [start_object](start_object.md) - the beginning of an object was read
|
||||
- [key](key.md) - an object key was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -192,6 +192,12 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [start_object](https://json.nlohmann.me/api/json_sax/start_object/index.md) - the beginning of an object was read
|
||||
- [key](https://json.nlohmann.me/api/json_sax/key/index.md) - an object key was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
+12
-2
File diff suppressed because one or more lines are too long
@@ -7,6 +7,24 @@ struct json_sax;
|
||||
|
||||
This class describes the SAX interface used by [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md). Each function is called in different situations while the input is parsed. The boolean return value informs the parser whether to continue processing the input.
|
||||
|
||||
For instance, parsing the JSON text `{"a": [1, true]}` triggers the following callbacks, in order:
|
||||
|
||||
```
|
||||
sequenceDiagram
|
||||
participant P as Parser
|
||||
participant H as SAX handler
|
||||
|
||||
P->>H: start_object(elements)
|
||||
P->>H: key("a")
|
||||
P->>H: start_array(elements)
|
||||
P->>H: number_unsigned(1)
|
||||
P->>H: boolean(true)
|
||||
P->>H: end_array()
|
||||
P->>H: end_object()
|
||||
```
|
||||
|
||||
Note `elements` is passed as `std::numeric_limits<std::size_t>::max()` (i.e., "unknown") for JSON text input; only binary formats such as CBOR or MessagePack may report the actual number of elements in `start_object`/ `start_array`. Also note that `1` is reported via `number_unsigned` rather than `number_integer` because it has no leading `-` sign.
|
||||
|
||||
## Template parameters
|
||||
|
||||
`BasicJsonType` : a specialization of [`basic_json`](https://json.nlohmann.me/api/basic_json/index.md)
|
||||
|
||||
@@ -35,6 +35,12 @@ It is safe to move the passed object key value.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [start_object](start_object.md) - the beginning of an object was read
|
||||
- [end_object](end_object.md) - the end of an object was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -200,6 +200,12 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [start_object](https://json.nlohmann.me/api/json_sax/start_object/index.md) - the beginning of an object was read
|
||||
- [end_object](https://json.nlohmann.me/api/json_sax/end_object/index.md) - the end of an object was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -26,6 +26,11 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
- [SAX Interface](../../features/parsing/sax_interface.md) - the SAX interface article
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -192,6 +192,11 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
- [SAX Interface](https://json.nlohmann.me/features/parsing/sax_interface/index.md) - the SAX interface article
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -34,6 +34,12 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [number_integer](number_integer.md) - an integer number was read
|
||||
- [number_unsigned](number_unsigned.md) - an unsigned integer number was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -198,6 +198,12 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [number_integer](https://json.nlohmann.me/api/json_sax/number_integer/index.md) - an integer number was read
|
||||
- [number_unsigned](https://json.nlohmann.me/api/json_sax/number_unsigned/index.md) - an unsigned integer number was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -31,6 +31,12 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [number_unsigned](number_unsigned.md) - an unsigned integer number was read
|
||||
- [number_float](number_float.md) - a floating-point number was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -196,6 +196,12 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [number_unsigned](https://json.nlohmann.me/api/json_sax/number_unsigned/index.md) - an unsigned integer number was read
|
||||
- [number_float](https://json.nlohmann.me/api/json_sax/number_float/index.md) - a floating-point number was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -31,6 +31,12 @@ Whether parsing should proceed.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [number_integer](number_integer.md) - an integer number was read
|
||||
- [number_float](number_float.md) - a floating-point number was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -196,6 +196,12 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [number_integer](https://json.nlohmann.me/api/json_sax/number_integer/index.md) - an integer number was read
|
||||
- [number_float](https://json.nlohmann.me/api/json_sax/number_float/index.md) - a floating-point number was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -39,6 +39,12 @@ Whether parsing should proceed (**must return `#!cpp false`**).
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
- [Parsing and Exceptions](../../features/parsing/parse_exceptions.md) - the article on handling parse errors without
|
||||
exceptions
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -202,6 +202,11 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
- [Parsing and Exceptions](https://json.nlohmann.me/features/parsing/parse_exceptions/index.md) - the article on handling parse errors without exceptions
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -35,6 +35,11 @@ Binary formats may report the number of elements.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [end_array](end_array.md) - the end of an array was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -200,6 +200,11 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [end_array](https://json.nlohmann.me/api/json_sax/end_array/index.md) - the end of an array was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -35,6 +35,12 @@ Binary formats may report the number of elements.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [end_object](end_object.md) - the end of an object was read
|
||||
- [key](key.md) - an object key was read
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -200,6 +200,12 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [end_object](https://json.nlohmann.me/api/json_sax/end_object/index.md) - the end of an object was read
|
||||
- [key](https://json.nlohmann.me/api/json_sax/key/index.md) - an object key was read
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
@@ -35,6 +35,11 @@ It is safe to move the passed string value.
|
||||
--8<-- "examples/sax_parse.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](../basic_json/sax_parse.md) - SAX parser
|
||||
- [SAX Interface](../../features/parsing/sax_interface.md) - the SAX interface article
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -200,6 +200,11 @@ parse_error(position=460, last_token=12.723374634<U+000A> }<U+000A> }]
|
||||
result: false
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [sax_parse](https://json.nlohmann.me/api/basic_json/sax_parse/index.md) - SAX parser
|
||||
- [SAX Interface](https://json.nlohmann.me/features/parsing/sax_interface/index.md) - the SAX interface article
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.2.0.
|
||||
|
||||
Reference in New Issue
Block a user