nlohmann_json 3.12.0: make from_json(std::optional) usable with
JSON_USE_IMPLICIT_CONVERSIONS=0 and include <optional> after the macros that
define JSON_HAS_CPP_17. Taken from PrusaSlicer deps/+json/json.patch, already
fixed on nlohmann/json develop.

--- a/bundled_deps/nlohmann_json/include/nlohmann/detail/conversions/from_json.hpp
+++ b/bundled_deps/nlohmann_json/include/nlohmann/detail/conversions/from_json.hpp
@@ -13,9 +13,6 @@
 #include <forward_list> // forward_list
 #include <iterator> // inserter, front_inserter, end
 #include <map> // map
-#ifdef JSON_HAS_CPP_17
-    #include <optional> // optional
-#endif
 #include <string> // string
 #include <tuple> // tuple, make_tuple
 #include <type_traits> // is_arithmetic, is_same, is_enum, underlying_type, is_convertible
@@ -32,6 +29,11 @@
 #include <nlohmann/detail/string_concat.hpp>
 #include <nlohmann/detail/value_t.hpp>
 
+// include after macro_scope.hpp
+#ifdef JSON_HAS_CPP_17
+    #include <optional> // optional
+#endif
+
 NLOHMANN_JSON_NAMESPACE_BEGIN
 namespace detail
 {
@@ -47,7 +49,7 @@ inline void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
 }
 
 #ifdef JSON_HAS_CPP_17
-#ifndef JSON_USE_IMPLICIT_CONVERSIONS
+#if !defined(JSON_USE_IMPLICIT_CONVERSIONS) || !JSON_USE_IMPLICIT_CONVERSIONS
 template<typename BasicJsonType, typename T>
 void from_json(const BasicJsonType& j, std::optional<T>& opt)
 {
