如何在 mule 4 中将 hashmap 转换为正确的 json 格式?

How to Convert hashmap into proper json format in mule 4?

我正在尝试记录我的哈希图,它看起来像这样:

如何将其转换为正确的 json 格式?

您可以使用Transform组件,编写dataweave代码如下:

%dw 2.0
output application/json
---
payload pluck(message,property,index) -> {(index) :{(property) :message}}

这应该有效。

只需在

流程的末尾添加一条转换消息
%dw2.0
application/json
---
payload