Existing JSON:
{
"name":"abc",
"place": "äbc"
}
I have a separte array as below:
[documentDetails:{
"name" : "doc1",
"size" : "5"
},
documentDetails:{
"name" : "doc1",
"size" : "5"
}
]
Final JSON REQUIRED:
{
"name":"abc",
"place": "äbc",
documentDetails:{
"name" : "doc1".
"size" : "5"
},
documentDetails:{
"name" : "doc1".
"size" : "5"
}
}
How can I achieve the final json ?
Try this:
%dw 2.0
output application/dw
var in1 = {
"name":"abc",
"place": "äbc"
}
var in2 = [
documentDetails:{
"name" : "doc1",
"size" : "5"
},
documentDetails:{
"name" : "doc1",
"size" : "5"
}
]
---
{
(in1),
(in2)
}
Note that your "separate array" has typos. Fixed to the best of my understanding.