diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index e39b7797d..8a8610821 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -320,7 +320,14 @@ template::type; - external_constructor::construct(j, static_cast(e)); + if (std::is_unsigned::value) + { + external_constructor::construct(j, static_cast(e)); + } + else + { + external_constructor::construct(j, static_cast(e)); + } } #endif // JSON_DISABLE_ENUM_SERIALIZATION