1

I'm fairly new to mulesoft, kindly help me with this one.

I'm having a http component in a for each loop,

for the first iteration it gives a payload like:

[
{
"Value1": "xxxx",
"Value2": "yyyy",
"Value3": "zzzz"
},
{
"Value1": "qqqq",
"Value2": "eeee",
"Value3": "rrrr"
}
]

and I'm storing this payload in a variable "var1"

for the second iteration it gives a payload like:

[
{
"Value1": "1234",
"Value2": "5678",
"Value3": "0987"
},
{
"Value1": "qqqq",
"Value2": "5yy4",
"Value3": "9jf7"
}
]

I need to combine them in a way that the result should be

[
{
"Value1": "xxxx",
"Value2": "yyyy",
"Value3": "zzzz"
},
{
"Value1": "qqqq",
"Value2": "eeee",
"Value3": "rrrr"
},
{
"Value1": "1234",
"Value2": "5678",
"Value3": "0987"
},
{
"Value1": "qqqq",
"Value2": "5yy4",
"Value3": "9jf7"
}
]

and store it in a variable, so that I can call it to set payload outside the for each loop.

Thank you for the help !!

johnny
  • 11
  • 1

1 Answers1

1

You can make use of expression transformer to concat the two Vars. If you want to do any more operations make use of Dataweave like below

flatten <listOfLists> => <mergedList>
vijay dhanakodi
  • 175
  • 1
  • 14