Skip to content

Commit 00990b1

Browse files
committed
further documentation improvements
Signed-off-by: Harinath Nampally <[email protected]>
1 parent e25fc04 commit 00990b1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

docs/mkdocs/docs/api/macros/nlohmann_json_serialize_enum _strict.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#define NLOHMANN_JSON_SERIALIZE_ENUM_STRICT(type, conversion...)
55
```
66

7-
The `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT` allows to define a user-defined serialization for every enumerator.
7+
The `NLOHMANN_JSON_SERIALIZE_ENUM_STRICT` macro allows defining a user-defined serialization for every enumerator.
88

99
This macro declares strict serialization and deserialization functions (`to_json` and `from_json`) for an enum type.
1010
Unlike [`NLOHMANN_JSON_SERIALIZE_ENUM`](nlohmann_json_serialize_enum.md), this macro enforces strict validation and
@@ -16,7 +16,7 @@ throws errors for unmapped values instead of defaulting to the first enum value.
1616
: name of the enum to serialize/deserialize
1717

1818
`conversion` (in)
19-
: a pair of an enumerator and a JSON serialization; arbitrary pairs can be given as a comma-separated list
19+
: A list of parameters alternating between an enumerator value and a string to use in the JSON serialization.
2020

2121
## Default definition
2222

@@ -37,10 +37,7 @@ inline void from_json(const BasicJsonType& j, type& e);
3737
3838
!!! important "Important notes"
3939
40-
- If an enum value appears more than once in the mapping, only the first occurrence will be used for serialization,
41-
subsequent mappings for the same enum value will be ignored.
42-
- If a JSON value appears more than once in the mapping, only the first occurrence will be used for deserialization,
43-
subsequent mappings for the same JSON value will be ignored.
40+
- Duplicate enum or JSON values in the mapping are not supported. Only the first occurrence will be used, and subsequent mappings will be ignored. This behavior is currently tolerated but may become an error in future versions.
4441
- Unlike `NLOHMANN_JSON_SERIALIZE_ENUM`, this macro enforces strict validation:
4542
- Attempting to serialize an unmapped enum value will throw a `type_error.302` exception
4643
- Attempting to deserialize an unmapped JSON value will throw a `type_error.302` exception
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[json.exception.type_error.302] can't deserialize - invalid json value : "yellow"
1+
[json.exception.type_error.302] deserialization failed: invalid JSON value "yellow"

0 commit comments

Comments
 (0)