0
votes

It would be helpful if someone could help below dataweave expression

  [
    [
       {"attribute": "a", "value": "2193605"}, 
       {"attribute": "b", "value": "2020-01-01"},
       {"attribute": "c", "value": "3000"}
    ], 
    [
       {"attribute": "a", "value": "3373448"},
       {"attribute": "b", "value": "2020-01-01"}, 
       {"attribute": "b", "value": "800"}
    ]
  ]

into

[
    {"a": "2193605", "b": "2020-01-01", "c": "3000"},
    {"a": "3373448", "b": "2020-01-01", "c": "800"}
]
1

1 Answers

2
votes
%dw 2.0
output application/json
---
payload map((item) ->
    item reduce((e,accum={}) ->
        accum ++ (e.attribute): e.value
    )
)