У меня есть объект JSON
{
"collection": [
{
"field1": "1111",
"field2": "1122"
},
{
"field1": "2211",
"field2": "2222"
}
],
"otherObject": {
"otherField": "3333"
}
}
Я хотел бы получить такой результат:
s01>1111~~~~~~1122~~~~~~
s01>2211~~~~~~2222~~~~~~
s02>3333~~~~~~
Итак, я использовал это преобразование:
%dw 1.0
%output text/plain structureIdent = "response" , schemaPath = "response.ffd"
---
{
collection: payload.collection map ({
field1: $.field1,
field2: $.field2
}),
otherObject: {
otherField: payload.otherObject.otherField
}
}
и мой response.ffd выглядит так
form: FIXEDWIDTH
structures:
- id: 'response'
name: response
tagStart: 0
data:
- { idRef: 'collection', count: '>1'}
- { idRef: 'otherObject', count: 1 }
segments:
- id: 'collection'
name: collection
tag: 's01>'
values:
- { name: 'field1', type: String, length: 10 }
- { name: 'field2', type: String, length: 10 }
- id: 'otherObject'
name: otherObject
tag: 's02>'
values:
- { name: 'otherField', type: String, length: 10 }
Но я получаю этот результат
s02>3333~~~~~~
как будто dataweave не знает о моем массиве, что мне делать, чтобы он заработал?