Status deserializeRow(const rj::Value& doc, Row& r) { if (!doc.IsObject()) { return Status(1); } for (const auto& i : doc.GetObject()) { std::string name(i.name.GetString()); if (!name.empty() && i.value.IsString()) { r[name] = i.value.GetString(); } } return Status(); }
Status serializeEvent(const QueryLogItem& item, const rj::Value& event_obj, JSON& doc, rj::Document& obj) { addLegacyFieldsAndDecorations(item, doc, obj); auto columns_obj = doc.getObject(); for (const auto& i : event_obj.GetObject()) { // Yield results as a "columns." map to avoid namespace collisions. doc.addCopy(i.name.GetString(), i.value.GetString(), columns_obj); } doc.add("columns", columns_obj, obj); return Status(0, "OK"); }