#ifndef JSON_UTIL_H
#define JSON_UTIL_H
#include "common/logging.h"
#include <nlohmann/json.hpp>

#define PARSE_JSON(field, to)  try \
{ \
    if (j.contains(#field)) \
    { \
        j.at(#field).get_to(to); \
    } \
} catch (const std::exception &e) \
{ \
    LOGGER_ERROR("JSON 解析失败，字段：【{}】【{}】，错误：{}", #field, #to, e.what()); \
} \
catch (...) \
{ \
    LOGGER_ERROR("未知异常，JSON 解析失败，字段：【{}】【{}】", #field, #to); \
}


#endif //JSON_UTIL_H
