Help with Fixed Collection Data Transformation in Declarative Style
Hi everyone,
I’m currently developing a custom node in the declarative style, as recommended, but I’m struggling with transforming data so that my API endpoint receives it in the expected format.
I have a Fixed Collection like this:
{
displayName: 'Item Test',
name: 'itemTest',
placeholder: 'Add Item Test',
type: 'fixedCollection',
default: '',
typeOptions: {
multipleValues: true,
},
options: [
{
name: 'itemValues',
displayName: 'Item',
values: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: 'Name of the Item',
},
{
displayName: 'Quantity',
name: 'quantity',
type: 'number',
default: '',
description: 'Item quantity',
},
],
},
],
}
With this setup, the node output looks like this:
{
"itemTest": {
"itemValues": [
{ "name": "Item 1", "quantity": 1 },
{ "name": "Item 2", "quantity": 2 }
]
}
}
However, my API expects the data in this format:
{
"items": [
{ "name": "Item 1", "quantity": 1 },
{ "name": "Item 2", "quantity": 2 }
]
}
Is there a way to transform the structure in declarative mode, or do I need to switch to programmatic mode? Any help or best practices would be greatly appreciated!
Thanks! ![]()
This post was written with the help of AI to improve clarity, as English is not my native language.