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

2

5

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 ?

Accompaniment answered 31/12, 2019 at 7:15 Comment(0)
G
2

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.

Guncotton answered 31/12, 2019 at 7:18 Comment(0)
C
4

Just add a transform message at the end of flow with

%dw2.0
application/json
---
payload
Chunk answered 31/12, 2019 at 21:5 Comment(0)
G
2

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.

Guncotton answered 31/12, 2019 at 7:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.