aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/json-impls.hh
blob: b26163a04aea6dda9642967ad5813ac2a8f85884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once
///@file

#include "nlohmann/json_fwd.hpp"

// Following https://github.com/nlohmann/json#how-can-i-use-get-for-non-default-constructiblenon-copyable-types
#define JSON_IMPL(TYPE)                                                \
    namespace nlohmann {                                               \
        using namespace nix;                                           \
        template <>                                                    \
        struct adl_serializer<TYPE> {                                  \
            static TYPE from_json(const json & json);                  \
            static void to_json(json & json, TYPE t);                  \
        };                                                             \
    }