1#include "mtx/events/tag.hpp"
2
3#include <nlohmann/json.hpp>
4
5using json = nlohmann::json;
6
7namespace mtx {
8namespace events {
9namespace account_data {
10
11void
12from_json(const json &obj, Tag &content)
13{
14 if (obj.contains(key: "order"))
15 content.order = obj.at(key: "order").get<double>();
16}
17
18void
19to_json(json &obj, const Tag &content)
20{
21 obj = nlohmann::json::object();
22 if (content.order)
23 obj["order"] = content.order.value();
24}
25
26void
27from_json(const json &obj, Tags &content)
28{
29 content.tags = obj.at(key: "tags").get<std::map<std::string, Tag>>();
30}
31
32void
33to_json(json &obj, const Tags &content)
34{
35 obj["tags"] = content.tags;
36}
37
38} // namespace state
39} // namespace events
40} // namespace mtx
41