diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index f1c876584..c5f4ce834 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -435,7 +435,12 @@ inline void to_json(BasicJsonType& j, const T& t) template inline void to_json(BasicJsonType& j, const std_fs::path& p) { +#if defined __cpp_lib_char8_t + j = reinterpret_cast(p.u8string().data()); +#else j = p.u8string(); +#endif + } #endif