162 {
163 if constexpr (Reflect::Reflectable<T>) {
164 nlohmann::json j = nlohmann::json::object();
165 std::apply(
166 [&](const auto&... props) {
168 },
169 T::describe());
170 return j;
171 } else if constexpr (Reflect::is_optional_v<T>) {
172 if (!val.has_value()) {
173 return nullptr;
174 }
176 } else if constexpr (Reflect::is_vector_v<T>) {
177 auto arr = nlohmann::json::array();
178 for (const auto& item : val) {
180 }
181 return arr;
182 } else if constexpr (Reflect::is_string_map_v<T>) {
183 nlohmann::json j = nlohmann::json::object();
184 for (const auto& [k, v] : val) {
186 }
187 return j;
188 } else if constexpr (std::is_enum_v<T>) {
189 return static_cast<std::underlying_type_t<T>>(val);
190 } else if constexpr (std::is_same_v<T, nlohmann::json>) {
191 return val;
192 } else {
193
195 }
196 }
static void encode_property(nlohmann::json &j, const Class &obj, const Reflect::Property< Class, T > &prop)
static nlohmann::json to_json(const T &val)
static nlohmann::json to_json(const T &val)