|
core-adapters 0.1.3
Third-party adapters for snicholls-core: nanobind helpers, nlohmann/json hooks, the snicholls_core Python package
|
nlohmann/json hooks for snicholls::uuid: the canonical lowercase 8-4-4-4-12 string.
More...
#include <optional>#include <string>#include <snicholls/core_adapters/nlohmann/json.hpp>#include <snicholls/core/uuid.hpp>Go to the source code of this file.
Functions | |
| void | snicholls::to_json (nlohmann::json &j, const uuid &u) |
Writes u as its canonical lowercase string. | |
| void | snicholls::from_json (const nlohmann::json &j, uuid &u) |
| Reads a canonical 8-4-4-4-12 string (either case). | |
nlohmann/json hooks for snicholls::uuid: the canonical lowercase 8-4-4-4-12 string.
nlohmann::json j = id; writes "f81d4fae-7dec-11d0-a765-00a0c91e6bf6" (snicholls::to_text, lowercase). j.get<snicholls::uuid>() reads the canonical form in either case (snicholls::parse_uuid with default options); braces, urn:uuid: and the 32-digit form are refused, as is a JSON number or byte array.snicholls::to_text, snicholls::parse_uuid (uuid.hpp); snicholls::json_error (json.hpp).to_json throws only std::bad_alloc.snicholls::json_error: not a string, or not a canonical UUID.to_text / parse_uuid plus one std::string.snicholls::core_json.Definition in file uuid_json.hpp.