45#ifndef snicholls_core_adapters_nlohmann_uuid_json_hpp
46#define snicholls_core_adapters_nlohmann_uuid_json_hpp
52#include <snicholls/core/uuid.hpp>
61inline void to_json(nlohmann::json& j,
const uuid& u) { j = std::string(to_text(u).view()); }
68inline void from_json(
const nlohmann::json& j, uuid& u)
70 const std::string& s = detail::json_string_or_throw(j,
"snicholls::uuid",
"a UUID string");
71 const std::optional<uuid> r = parse_uuid(s);
73 detail::throw_json_error(
"snicholls::uuid",
"not a canonical 8-4-4-4-12 UUID:", s);
void from_json(const nlohmann::json &j, decimal &d)
Reads canonical decimal text from a JSON string.
void to_json(nlohmann::json &j, const decimal &d)
Writes d as its canonical text, a JSON string.
snicholls::json_error and the nlohmann/json adapter layer: shared by every adapter.