File tree 1 file changed +4
-8
lines changed
fable/include/fable/schema
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -77,24 +77,20 @@ class FromJson : public Base<FromJson<T>> {
77
77
void reset_ptr () override { ptr_ = nullptr ; }
78
78
79
79
[[nodiscard]] Json serialize (const Type& x) const {
80
- Json j;
81
- serialize_into (j, x);
82
- return j;
80
+ return Json (x);
83
81
}
84
82
85
83
void serialize_into (Json& j, const Type& x) const {
86
- to_json (j, x);
84
+ ::nlohmann::adl_serializer<Type>:: to_json (j, x);
87
85
}
88
86
89
87
template <typename = std::enable_if<std::is_default_constructible_v<Type>>>
90
88
[[nodiscard]] Type deserialize (const Conf& c) const {
91
- Type x;
92
- deserialize_into (c, x);
93
- return x;
89
+ return c->get <Type>();
94
90
}
95
91
96
92
void deserialize_into (const Conf& c, Type& x) const {
97
- from_json (*c, x);
93
+ c-> get_to ( x);
98
94
}
99
95
100
96
private:
You can’t perform that action at this time.
0 commit comments