mirror of
https://github.com/nlohmann/json.git
synced 2026-10-04 05:30:31 +00:00
deploy: 63c10a51fc
This commit is contained in:
@@ -47,7 +47,7 @@ inline void from_json(const BasicJsonType& j, type& e);
|
||||
|
||||
## Examples
|
||||
|
||||
??? example "Example 1: Basic usage"
|
||||
??? example "Example: Basic usage"
|
||||
|
||||
The example shows how `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT` can be used to serialize/deserialize both classical enums and
|
||||
C++11 enum classes:
|
||||
@@ -62,7 +62,7 @@ inline void from_json(const BasicJsonType& j, type& e);
|
||||
--8<-- "examples/nlohmann_json_serialize_enum_strict.output"
|
||||
```
|
||||
|
||||
??? example "Example 2: Multiple conversions for one enumerator"
|
||||
??? example "Example: Multiple conversions for one enumerator"
|
||||
|
||||
The example shows how to use multiple conversions for a single enumerator. In the example, `Color::red` will always
|
||||
be *serialized* to `"red"`, because the first occurring conversion. The second conversion, however, offers an
|
||||
@@ -78,7 +78,7 @@ inline void from_json(const BasicJsonType& j, type& e);
|
||||
--8<-- "examples/nlohmann_json_serialize_enum_strict_2.output"
|
||||
```
|
||||
|
||||
??? example "Example 3: exceptions on invalid serialization"
|
||||
??? example "Example: exceptions on invalid serialization"
|
||||
|
||||
The example shows how an invalid serialization causes an exception to be thrown. In the example,
|
||||
Color::unknown is not defined in the mapping used to call `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT`
|
||||
|
||||
Reference in New Issue
Block a user