From 0d106bde218d80783056006038f6e54d88af952f Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 30 Jan 2024 21:45:58 -0600 Subject: [PATCH] [ox/oc] Fix objects to always write when members of arrays --- deps/ox/src/ox/oc/write.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } }