I am having an input JSON which I would like to transform using Mule's dataweave 2.0.
Below is the input JSON.
[
{
"data1": {
"role": "analyst",
"name": "ABC"
},
"data2": {
"role": "analyst",
"name": "DEF"
}
},
{
"data1": {
"role": "RM",
"name": "PQRS"
},
"data2": {
"role": "analyst",
"name": "QWE"
}
}
]
We would like the output as below :
[
{
"role": "analyst",
"name": "ABC"
},
{
"role": "analyst",
"name": "DEF"
},
{
"role": "RM",
"name": "PQRS"
},
{
"role": "analyst",
"name": "QWE"
}
]
I have tried different options using map, pluck and flatten, but could not get the solution. Please help me with the transform function for this.