Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to log my hashmap it looks something like this : enter image description here

How do I convert it into proper json format ?

like image 996
iron_man Avatar asked Dec 31 '19 07:12

iron_man


2 Answers

Just add a transform message at the end of flow with

%dw2.0
application/json
---
payload
like image 118
maddestroyer7 Avatar answered Oct 03 '22 15:10

maddestroyer7


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.

like image 31
HMT Avatar answered Oct 03 '22 16:10

HMT