From 9fda7dfb93c6589d77cee826d9725abd7950a48e Mon Sep 17 00:00:00 2001 From: Lorenzo Susini Date: Wed, 31 May 2023 10:34:17 +0000 Subject: [PATCH] fix(userspace/engine): store alternatives as array in -L json output Signed-off-by: Lorenzo Susini --- userspace/engine/falco_engine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index 341281eb..a52caa16 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -483,11 +483,13 @@ void falco_engine::describe_rule(std::string *rule, bool json) const r["name"] = req.at(0).name; r["version"] = req.at(0).version; - Json::Value alternatives; + Json::Value alternatives = Json::arrayValue; for(size_t i = 1; i < req.size(); i++) { - alternatives["name"] = req[i].name; - alternatives["version"] = req[i].version; + Json::Value alternative; + alternative["name"] = req[i].name; + alternative["version"] = req[i].version; + alternatives.append(alternative); } r["alternatives"] = alternatives;