https://github.com/nlohmann/json/pull/4736/commits/34868f90149de02432ea758a29227a6ad74f098c

Index: include/nlohmann/detail/conversions/from_json.hpp
--- include/nlohmann/detail/conversions/from_json.hpp.orig
+++ include/nlohmann/detail/conversions/from_json.hpp
@@ -540,7 +540,10 @@ inline void from_json(const BasicJsonType& j, std_fs::
         JSON_THROW(type_error::create(302, concat("type must be string, but is ", j.type_name()), &j));
     }
     const auto& s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
-#ifdef JSON_HAS_CPP_20
+    // Checking for C++20 standard or later can be insufficient in case the
+    // library support for char8_t is either incomplete or was disabled
+    // altogether. Use the __cpp_lib_char8_t feature test instead.
+#if defined(__cpp_lib_char8_t) && (__cpp_lib_char8_t >= 201907L)
     p = std_fs::path(std::u8string_view(reinterpret_cast<const char8_t*>(s.data()), s.size()));
 #else
     p = std_fs::u8path(s); // accepts UTF-8 encoded std::string in C++17, deprecated in C++20
