[ox/oc] Fix objects to always write when members of arrays
This commit is contained in:
parent
b75bbc4d20
commit
0d106bde21
4
deps/ox/src/ox/oc/write.hpp
vendored
4
deps/ox/src/ox/oc/write.hpp
vendored
@ -27,7 +27,7 @@ class OrganicClawWriter {
|
|||||||
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Json::Value m_json;
|
Json::Value m_json{Json::Value(Json::objectValue)};
|
||||||
Json::ArrayIndex m_fieldIt = 0;
|
Json::ArrayIndex m_fieldIt = 0;
|
||||||
int m_unionIdx = -1;
|
int m_unionIdx = -1;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ Error OrganicClawWriter::field(const char *key, const T *val) noexcept {
|
|||||||
OrganicClawWriter w;
|
OrganicClawWriter w;
|
||||||
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler{&w};
|
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler{&w};
|
||||||
oxReturnError(model(&handler, val));
|
oxReturnError(model(&handler, val));
|
||||||
if (!w.m_json.isNull()) {
|
if (!w.m_json.empty() || m_json.isArray()) {
|
||||||
value(key) = w.m_json;
|
value(key) = w.m_json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user