-- Copyright (c) 2024 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

local message = ProcessingFlow[1].Destination.Message
local message_id = ProcessingFlow[1].Destination.MessageId
local message_args = ProcessingFlow[1].Destination.MessageArgs
local res = cjson.json_object_new_array()
if #message == 0 and #message_id == 0 and #message_args == 0 then
    return res
end
local t = cjson.json_object_new_object()
t.Message = message
t.MessageId = message_id
t.MessageArgs = cjson.json_object_from_table(message_args) or cjson.json_object_new_array()
res[#res+1] = t
return res
