144 {
145 if constexpr (Reflectable<T>) {
146 nlohmann::json j = nlohmann::json::object();
147 std::apply(
148 [&](const auto&... props) {
150 },
151 T::describe());
152 return j;
153 } else if constexpr (is_optional_v<T>) {
154 if (!val.has_value()) {
155 return nullptr;
156 }
158 } else if constexpr (is_vector_v<T>) {
159 auto arr = nlohmann::json::array();
160 for (const auto& item : val) {
162 }
163 return arr;
164 } else if constexpr (is_string_map_v<T>) {
165 nlohmann::json j = nlohmann::json::object();
166 for (const auto& [k, v] : val) {
168 }
169 return j;
170 } else if constexpr (GlmSerializable<T>) {
172 } else if constexpr (std::is_enum_v<T>) {
173 return static_cast<std::underlying_type_t<T>>(val);
174 } else if constexpr (std::is_same_v<T, nlohmann::json>) {
175 return val;
176 } else {
177 return val;
178 }
179 }
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)