Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/mkdocs/docs/features/enum_conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ Other Important points:

- When using `get<ENUM_TYPE>()`, undefined JSON values will default to the first pair specified in your map. Select this
default pair carefully.
- **Unknown string values** that do not match any mapped string also deserialize to that same first pair—they do not
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true once #5151 is merged.

throw `json::exception::type_error` like a failed `get<std::string>()` on a JSON number would. If you need
deserialization to fail on unrecognized strings, provide a custom `from_json` (see
[Arbitrary Type Conversions](arbitrary_types.md)) or follow the discussion in
[issue #3992](https://github.com/nlohmann/json/issues/3992).
- If an enum or JSON value is specified more than once in your map, the first matching occurrence from the top of the
map will be returned when converting to or from JSON.
- To disable the default serialization of enumerators as integers and force a compiler error instead, see [`JSON_DISABLE_ENUM_SERIALIZATION`](../api/macros/json_disable_enum_serialization.md).
Loading