4#include <nlohmann/json.hpp>
6#define NLOHMANN_JSON_FROM_NON_THROWING(v1) \
7 if (nlohmann_json_j.contains(#v1)) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
8#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_NON_THROWING(Type, ...) \
9 friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
10 friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_NON_THROWING, __VA_ARGS__)) }
12#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_NON_THROWING(Type, ...) \
13 inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
14 inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_NON_THROWING, __VA_ARGS__)) }
19struct nlohmann::adl_serializer<std::optional<T>> {
20 static void to_json(nlohmann::json& j,
const std::optional<T>& v) {
27 static void from_json(
const nlohmann::json& j, std::optional<T>& v) {
static void from_json(const nlohmann::json &j, std::optional< T > &v)
Definition nlohmannJsonExtension.h:27
static void to_json(nlohmann::json &j, const std::optional< T > &v)
Definition nlohmannJsonExtension.h:20