Входная полезная нагрузка:
{
"city": [
{
"street": "street",
"zip": "223344"
}
],
"document": [
{
"date": "2020-01-10T04:04:01-08:00",
"id": "12345678",
"file_name": "test.xml"
}
]
}
Потоковая переменная с именем "documentsInfo":
[
{
"date": "2020-01-10T04:04:01-08:00",
"id": "123456789",
"file_name": "test2.xml"
},
{
"date": "2020-01-10T04:04:01-08:00",
"id": "1234567800",
"file_name": "test3.xml"
}
]
Плетение данных:
%dw 2.0
output application/json
---
{
city: payload.city,
documents: payload.document ++ vars.documentsInfo
}
Производит вывод:
{
"city": [
{
"street": "street",
"zip": "223344"
}
],
"documents": [
{
"date": "2020-01-10T04:04:01-08:00",
"id": "12345678",
"file_name": "test.xml"
},
{
"date": "2020-01-10T04:04:01-08:00",
"id": "123456789",
"file_name": "test2.xml"
},
{
"date": "2020-01-10T04:04:01-08:00",
"id": "1234567800",
"file_name": "test3.xml"
}
]
}