Send Array as Value in Node

Describe the issue/error/question

Hi there, I’ve run into an issue developing a new node. In short I have an API endpoint that needs to accept a body that looks roughly like the one below. It needs to take an array of tags; however, whenever I get the data with my code, the array value has a prefix of “Array”. Is there a way to remove this and have the input array?

Actual

{
  "machineTags": "[Array: [\"test\",\"test2\"]]"
}

Desired state

{
    "machineTags": ["test","test2"]
}

Code Block

{
		displayName: 'Properties',
		name: 'properties',
		type: 'collection',
		placeholder: 'Add Field',
		default: {},
		options: [
			{
				name: 'machineTags',
				default: '',
				description: 'Set of machine tags.',
				displayName: 'Machine Tags',
				type: 'json',
				routing: {
					send: {
						property: 'machineTags',
						type: 'body',
						value: "={{$value.split(',')}}",
					},
				},
			},

Any help would be greatly appreciated!

Thanks!

Sorry, that seems to be a bug. Thank you very much for making us aware of that. I could reproduce it. We will have a look and fix.

If it is urgent, a temporary possible workaround would be setting the parameter via a preSend function. You can find an example of such a function here:

A PR to fix that issue got created and should be merged and released soon.

Thanks @jan, I was scratching my head over this one for a while.

Also if you don’t mind me asking, I’m still getting into declarative node development. What is the main purpose of the preSend function?

The preSend function gets executed before the request gets made. So you can literally change everything on the request you want. Like for example querying the parameter value manually and adding it to the request (similar to how the old style worked).

Sorry for the delay. Got now reviewed and merged and will now go out in the next few days with the new version.