142 {
143 if constexpr (Reflectable<T>) {
144 nlohmann::json j = nlohmann::json::object();
145 std::apply(
146 [&](const auto&... props) {
148 },
149 T::describe());
150 return j;
151 } else if constexpr (is_optional_v<T>) {
152 if (!val.has_value()) {
153 return nullptr;
154 }
156 } else if constexpr (is_vector_v<T>) {
157 auto arr = nlohmann::json::array();
158 for (const auto& item : val) {
160 }
161 return arr;
162 } else if constexpr (is_string_map_v<T>) {
163 nlohmann::json j = nlohmann::json::object();
164 for (const auto& [k, v] : val) {
166 }
167 return j;
168 } else if constexpr (GlmSerializable<T>) {
170 } else if constexpr (std::is_enum_v<T>) {
171 return static_cast<std::underlying_type_t<T>>(val);
172 } else {
173 return val;
174 }
175 }
static nlohmann::json encode_glm(const T &v)
static void encode_property(nlohmann::json &j, const Class &obj, const Property< Class, T > &prop)
static nlohmann::json to_json(const T &val)