225 {
226 if constexpr (Reflect::Reflectable<T>) {
227 if (!j.is_object()) {
228 throw nlohmann::json::type_error::create(302, "expected object for Reflectable type", &j);
229 }
230 std::apply(
231 [&](const auto&... props) {
233 },
234 T::describe());
235 } else if constexpr (Reflect::is_optional_v<T>) {
236 using Inner = typename Reflect::is_optional<T>::inner;
237 if (j.is_null()) {
239 } else {
240 Inner inner {};
242 out = std::move(inner);
243 }
244 } else if constexpr (Reflect::is_vector_v<T>) {
245 using V =
typename Reflect::is_vector<T>::element;
246 if (!j.is_array())
247 throw nlohmann::json::type_error::create(302, "expected array", &j);
249 out.reserve(j.size());
250 for (const auto& item : j) {
253 out.push_back(std::move(element));
254 }
255
256 } else if constexpr (Reflect::is_string_map_v<T>) {
257 using V =
typename Reflect::is_string_map<T>::element;
258 if (!j.is_object())
259 throw nlohmann::json::type_error::create(302, "expected object for map", &j);
261 for (const auto& [k, v] : j.items()) {
264 out.emplace(k, std::move(val));
265 }
266 } else if constexpr (std::is_enum_v<T>) {
267 out =
static_cast<T>(j.get<std::underlying_type_t<T>>());
268
269 } else if constexpr (std::is_same_v<T, nlohmann::json>) {
271
272 } else {
274 }
275 }
std::vector< float > * out
static void from_json(const nlohmann::json &j, T &out)
static void decode_property(const nlohmann::json &j, Class &obj, const Reflect::Property< Class, T > &prop)
static void from_json(const nlohmann::json &j, T &out)