mirror of
https://github.com/nlohmann/json.git
synced 2026-07-29 23:23:02 +04:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04c29e90c4 | |||
| 0606809490 | |||
| 4cb4fbb6fe | |||
| 17d3b523f9 | |||
| 45d2de5d9d | |||
| ff9a03237d |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -49,7 +49,7 @@ Unlike the [`parse()`](parse.md) function, this function neither throws an excep
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::counted_iterator` with a different sentinel type
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -49,7 +49,7 @@ Unlike the [`parse()`](https://json.nlohmann.me/api/basic_json/parse/index.md) f
|
||||
|
||||
```
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::counted_iterator` with a different sentinel type
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -43,6 +43,17 @@ Strong guarantee: if an exception is thrown, there are no changes to any JSON va
|
||||
Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value
|
||||
is not UTF-8 encoded and `error_handler` is set to `strict`
|
||||
|
||||
!!! warning "Serializing untrusted input"
|
||||
|
||||
When serializing values that may contain invalid or untrusted UTF-8 (e.g., bytes taken directly from network
|
||||
input), `dump()` throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) in the default
|
||||
`strict` mode. To serialize such data without throwing, pass
|
||||
[`error_handler_t::replace`](error_handler_t.md) (substitutes U+FFFD) or
|
||||
[`error_handler_t::ignore`](error_handler_t.md). Callers that serialize untrusted input on a crash-sensitive path
|
||||
should either choose a non-strict error handler or wrap `dump()` in a `#!cpp try`/`#!cpp catch`.
|
||||
|
||||
See the [FAQ](../../home/faq.md#serializing-untrusted-or-invalid-utf-8) for details.
|
||||
|
||||
## Complexity
|
||||
|
||||
Linear.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -31,6 +31,12 @@ Strong guarantee: if an exception is thrown, there are no changes to any JSON va
|
||||
|
||||
Throws [`type_error.316`](https://json.nlohmann.me/home/exceptions/#jsonexceptiontype_error316) if a string stored inside the JSON value is not UTF-8 encoded and `error_handler` is set to `strict`
|
||||
|
||||
Serializing untrusted input
|
||||
|
||||
When serializing values that may contain invalid or untrusted UTF-8 (e.g., bytes taken directly from network input), `dump()` throws [`type_error.316`](https://json.nlohmann.me/home/exceptions/#jsonexceptiontype_error316) in the default `strict` mode. To serialize such data without throwing, pass [`error_handler_t::replace`](https://json.nlohmann.me/api/basic_json/error_handler_t/index.md) (substitutes U+FFFD) or [`error_handler_t::ignore`](https://json.nlohmann.me/api/basic_json/error_handler_t/index.md). Callers that serialize untrusted input on a crash-sensitive path should either choose a non-strict error handler or wrap `dump()` in a `try`/`catch`.
|
||||
|
||||
See the [FAQ](https://json.nlohmann.me/home/faq/#serializing-untrusted-or-invalid-utf-8) for details.
|
||||
|
||||
## Complexity
|
||||
|
||||
Linear.
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -36,8 +36,10 @@ The exact mapping and its limitations are described on a [dedicated page](../../
|
||||
: a compatible iterator type
|
||||
|
||||
`SentinelType`
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a
|
||||
custom sentinel type for C++20 ranges
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,7 +35,12 @@ The exact mapping and its limitations are described on a [dedicated page](https:
|
||||
|
||||
`IteratorType` : a compatible iterator type
|
||||
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a custom sentinel type for C++20 ranges
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
```
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@ The exact mapping and its limitations are described on a [dedicated page](../../
|
||||
: a compatible iterator type
|
||||
|
||||
`SentinelType`
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a
|
||||
custom sentinel type for C++20 ranges
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,7 +35,12 @@ The exact mapping and its limitations are described on a [dedicated page](https:
|
||||
|
||||
`IteratorType` : a compatible iterator type
|
||||
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a custom sentinel type for C++20 ranges
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
```
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
@@ -39,8 +39,10 @@ The exact mapping and its limitations are described on a [dedicated page](../../
|
||||
: a compatible iterator type
|
||||
|
||||
`SentinelType`
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a
|
||||
custom sentinel type for C++20 ranges
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -38,7 +38,12 @@ The exact mapping and its limitations are described on a [dedicated page](https:
|
||||
|
||||
`IteratorType` : a compatible iterator type
|
||||
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a custom sentinel type for C++20 ranges
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
```
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@ The exact mapping and its limitations are described on a [dedicated page](../../
|
||||
: a compatible iterator type
|
||||
|
||||
`SentinelType`
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a
|
||||
custom sentinel type for C++20 ranges
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,7 +35,12 @@ The exact mapping and its limitations are described on a [dedicated page](https:
|
||||
|
||||
`IteratorType` : a compatible iterator type
|
||||
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a custom sentinel type for C++20 ranges
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
```
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@ The exact mapping and its limitations are described on a [dedicated page](../../
|
||||
: a compatible iterator type
|
||||
|
||||
`SentinelType`
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a
|
||||
custom sentinel type for C++20 ranges
|
||||
: defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,7 +35,12 @@ The exact mapping and its limitations are described on a [dedicated page](https:
|
||||
|
||||
`IteratorType` : a compatible iterator type
|
||||
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance a custom sentinel type for C++20 ranges
|
||||
`SentinelType` : defaults to `IteratorType`; may be a different type comparable to `IteratorType` via `operator!=`, for instance.
|
||||
|
||||
```
|
||||
- a custom sentinel type for C++20 ranges
|
||||
- `std::default_sentinel_t`, when `IteratorType` is `std::counted_iterator`
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user