如果有人能帮助下面的数据编织表达式,将会很有帮助。
[
[
{"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"}
]
]
变成
[
{"a": "2193605", "b": "2020-01-01", "c": "3000"},
{"a": "3373448", "b": "2020-01-01", "c": "800"}
]
%dw 2.0
output application/json
---
payload map((item) ->
item reduce((e,accum={}) ->
accum ++ (e.attribute): e.value
)
)