Format a fixedCollection in a JSON nested object

Hi there,

I’m trying to create my very first declarative-style custom node.
I need to send a simple nested object. I can get it to be displayed in the UI but the JSON output contains twice the property name.

Here’s the fixedCollection declaration :

{
	displayName: 'Address',
	name: 'address',
	type: 'fixedCollection',
	default: {},
	placeholder: 'Add Address Field',
	options: [
		{
			displayName: 'Address Fields',
			name: 'address',
			values: [
				{
					displayName: 'Street Address 1',
					name: 'streetAddress1',
					type: 'string',
					default: '',
				}
			],
		},
	],
	routing: {
		send: {
			type: 'body',
			property: 'address',
		},
	},
};

And here the json ouput:

address: {
	address: {
		streetAddress1: "a street adress"
	}
}

Seems legit but I don’t know how to remove the first node. Maybe with the preSend option ?

Thank you for your help !

Hey @jerome,

Welcome to the community :raised_hands:

I guess the problem here is where you have the collection called address and the option called address as well. A quick solution might be to set the property to address.address and see if that works.

I have a similar problem. Is there a solution for this?

{
		displayName: 'Passengers',
		name: 'Passengers',
		type: 'fixedCollection',
		placeholder: 'Add Passenger',
		typeOptions: {
			multipleValues: true
		},
		default: [],
		options: [
			{
				displayName: 'Passenger',
				name: 'Passenger',
				values: [
					{
						displayName: 'Passenger Type Code',
						name: 'passengerTypeCode',
						type: 'options',
						default: 'AD',
						options: [{
							name: 'Adult',
							value: 'AD'
						},{
							name: 'Child',
							value: 'CHD'
						},{
							name: 'Infant',
							value: 'INF'
						}]
					},
					{
						displayName: 'Quantity',
						name: 'quantity',
						type: 'number',
						default: 1,
					},
				]
			}
		],
		displayOptions: {
			show: {
				resource: ['searchFlights'],
				operation: ['post'],
			},
		},
		routing: {
			send: {
				property: "Passengers",
				type: "body"
			},
		},
	},

It outputs:

{
  "Passengers": {
    "Passenger": [
      {
        "passengerTypeCode": "AD",
        "quantity": 1
      },
      {
        "passengerTypeCode": "CHD",
        "quantity": 1
      }
    ]
  }
}

But I need:

{
  "Passengers": [
    {
      "passengerTypeCode": "AD",
      "quantity": 1
    },
    {
      "passengerTypeCode": "CHD",
      "quantity": 1
    }
  ]
}