update the explicit macros expansion

This commit is contained in:
George Sedov 2025-01-23 18:22:21 +01:00
parent 070ca3f811
commit f00f89406c

View File

@ -13,18 +13,18 @@ struct person
int age;
};
void to_json(nlohmann::json& nlohmann_json_j, const person& nlohmann_json_t)
{
nlohmann_json_j["json_name"] = nlohmann_json_t.name;
nlohmann_json_j["json_address"] = nlohmann_json_t.address;
nlohmann_json_j["json_age"] = nlohmann_json_t.age;
template <typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int >= 0>
void to_json(BasicJsonType& nlohmann_json_j, const person& nlohmann_json_t) {
nlohmann_json_j["json_name"] = nlohmann_json_t.name;
nlohmann_json_j["json_address"] = nlohmann_json_t.address;
nlohmann_json_j["json_age"] = nlohmann_json_t.age;
}
void from_json(const nlohmann::json& nlohmann_json_j, person& nlohmann_json_t)
{
nlohmann_json_t.name = nlohmann_json_j.at("json_name");
nlohmann_json_t.address = nlohmann_json_j.at("json_address");
nlohmann_json_t.age = nlohmann_json_j.at("json_age");
template <typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int >= 0>
void from_json(const BasicJsonType& nlohmann_json_j, person& nlohmann_json_t) {
nlohmann_json_j.at("json_name").get_to(nlohmann_json_t.name);
nlohmann_json_j.at("json_address").get_to(nlohmann_json_t.address);
nlohmann_json_j.at("json_age").get_to(nlohmann_json_t.age);
}
} // namespace ns