diff --git a/deps/ox/src/ox/oc/write.hpp b/deps/ox/src/ox/oc/write.hpp index a6a11038..b6e22239 100644 --- a/deps/ox/src/ox/oc/write.hpp +++ b/deps/ox/src/ox/oc/write.hpp @@ -27,7 +27,7 @@ class OrganicClawWriter { friend Result writeOC(const auto &val) noexcept; protected: - Json::Value m_json; + Json::Value m_json{Json::Value(Json::objectValue)}; Json::ArrayIndex m_fieldIt = 0; int m_unionIdx = -1; @@ -215,7 +215,7 @@ Error OrganicClawWriter::field(const char *key, const T *val) noexcept { OrganicClawWriter w; ModelHandlerInterface handler{&w}; oxReturnError(model(&handler, val)); - if (!w.m_json.isNull()) { + if (!w.m_json.empty() || m_json.isArray()) { value(key) = w.m_json; } }