
Hello I am trying to transform this array :
[
{"a":"1",
"b":"2"},
{"a":"3",
"b":"4"},
{"a":"5",
"b":"6"}
]
into:
{"a":"1",
"b":"2",
"a":"3",
"b":"4",
"a":"5",
"b":"6"}
2 answers
@Arnaud Gohier you can try surrounding your array with braces {()}:
%dw 2.0
output application/json
var a = [
{
"a": "1",
"b": "2"
},
{
"c": "3",
"d": "4"
},
{
"e": "5",
"f": "6"
}
]
---
{(a)}
output:
{
"a": "1",
"b": "2",
"c": "3",
"d": "4",
"e": "5",
"f": "6"
}
Note: If you use the values specified in your example, this will result in invalid json (it will contain duplicate keys).