mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 21:20:30 +00:00
deploy: 63c10a51fc
This commit is contained in:
@@ -48,7 +48,7 @@ Linear in the size of the JSON value `j`.
|
||||
|
||||
## Examples
|
||||
|
||||
??? example
|
||||
??? example "Example: serialize a JSON value to BON8"
|
||||
|
||||
The example shows the serialization of a JSON value to a byte vector in BON8 format.
|
||||
|
||||
@@ -62,6 +62,21 @@ Linear in the size of the JSON value `j`.
|
||||
--8<-- "examples/to_bon8.output"
|
||||
```
|
||||
|
||||
??? example "Example: type_error.316 exception"
|
||||
|
||||
The example shows how serializing a string that is not valid UTF-8 throws an exception, because BON8 stores strings
|
||||
as UTF-8.
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/to_bon8__exception.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/to_bon8__exception.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [from_bon8](from_bon8.md) create a JSON value from an input in BON8 format
|
||||
|
||||
Reference in New Issue
Block a user