diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 35be5de4..04c93be1 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -248,10 +248,12 @@ void to_json(BasicJsonType& j, const std::vector& e) external_constructor::construct(j, e); } -template::value or - std::is_same::value, - int> = 0> +template ::value and + not is_compatible_object_type< + BasicJsonType, CompatibleArrayType>::value, + int> = 0> void to_json(BasicJsonType& j, const CompatibleArrayType& arr) { external_constructor::construct(j, arr); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 0d2f9f01..4590b694 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -1769,10 +1769,12 @@ void to_json(BasicJsonType& j, const std::vector& e) external_constructor::construct(j, e); } -template::value or - std::is_same::value, - int> = 0> +template ::value and + not is_compatible_object_type< + BasicJsonType, CompatibleArrayType>::value, + int> = 0> void to_json(BasicJsonType& j, const CompatibleArrayType& arr) { external_constructor::construct(j, arr);