简体   繁体   中英

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

I am trying to log my hashmap it looks something like this : 在此处输入图片说明

How do I convert it into proper json format ?

Just add a transform message at the end of flow with

%dw2.0
application/json
---
payload

You can use the Transform Component and write the dataweave code as follows:

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

This should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM