Issue in reading JSON Array from a custom node

Describe the issue/error/question

I have created a custom node that is supposed to read a JSON Array. But n8n is appending something like [Array: ] at the beginning because of which it’s erroring out as in my node I am doing JSON.parse() to read the data.

Tried several methods, including removing the Array: part using JS slice method and then parsing. Nothing seems to work.

What is the error message (if any)?

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node


Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Hey @Rajarshi_Sengupta,
welcome to the community :tada:

Our Expression Editor is showing the results as [Array: [...]] to illustrate that you are referencing an array. I guess inside your node’s execute function you are using something like:

const arrayOfObjects = this.getNodeParameter('arrayOfObjects');

In that case the arrayOfObjects should be an array. Can you check if that is the case or can you check the type like this?

console.log('typeof arrayOfObjects', typeof arrayOfObjects);

Also, what type is your property arrayOfObjects?

Hi @marcus, The type property set is json.

Hey @Rajarshi_Sengupta,

That looks to be how we display an array, Have you tried using the Array or posting it to a web service to see what arrives?