I have below input payload, the expected output should be swapped
Input:
[{
"name" : "A",
"id" : 1
},
{
"name" : "B",
"id" : 2
}]
output:
[{
"A" : "name",
1 : "id"
},
{
"B" : "name",
2 : "id"
}]
6 respostas
For Objects, it will be mapObject :
%dw 2.0
output application/json
---
payload mapObject
($) : $$
Go through docs to get ideas and examples for dataweave :