97008 48403
+91 40-27177600

Blog

Merging two JSON outputs into one with Dataweave in Mule ESB

single-blog

From the technical center of excellence of Massil Technologies, our technology leaders make it easy to understand the complex situations you come across in Mule ESB from the experience of Massil Technologies to have countered them in their experience of working on client projects in real time. This blog talks about merging two JSON outputs into one using dataweave in Mule ESB. This blog is a part of series of blogs being authored and published by Massil Technologies for the benefit of the IT community globally.

We now are going to see a step by step approach to merge two JSON outputs into one.

Step 1:

In Anypoint Studio click File > New > Mule Project to create a new project, give it whatever name you wish and click Finish.

Step 2:

Drag an HTTP Connector from the palette to your empty canvas, then a set payload

Step 3:

In set, payload take JSON file

Step 4:

Drag a json-to-object from the palette

Step 5:

Drag a variable from the palette

Step 6:

Drag an set payload from the palette

Step 7:

 

drag an Transform Message from the palette

 

filtering UserPayload

%dw 1.0

%output application/json

payload map (action, index) -> {

user: action.user,

action: action.action,

FileName: action.FileName,

userId: (flowVars.UserPayload filter $.objectId == action.user)[0].objectName

}

Step 8:

 

Run your Mule project

Step 9:

Send JSON file using postman to the project

The output is

Hence, we have gone through the step by step process to depict the way Massil Technologies team has addressed. Hope this article from Massil Technologies was useful for you. If you have any further queries on this topic, please reach out to info@massil.tech.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Get in touch with us

Scroll to top