26 #ifndef DIGITALCURLING3_JSON_COMMON_HPP
27 #define DIGITALCURLING3_JSON_COMMON_HPP
31 #include "nlohmann/json.hpp"
38 struct adl_serializer<std::optional<T>> {
39 static void to_json(json & j, std::optional<T>
const& opt)
48 static void from_json(json
const& j, std::optional<T> & opt)
65 struct adl_serializer<std::chrono::milliseconds> {
66 static void to_json(json & j, std::chrono::milliseconds
const& ms)
68 j =
static_cast<double>(ms.count()) / 1000.0;
71 static void from_json(json
const& j, std::chrono::milliseconds & ms)
73 ms = std::chrono::milliseconds(
74 static_cast<std::chrono::milliseconds::rep
>(
76 j.get<
double>() * 1000.0)));
82 #endif // DIGITALCURLING3_JSON_COMMON_HPP