Remove columns (code node), actually removes columns from the entire JSON


I am using a code node to remove columns from my JSON (for performance purpose):

Here is an example:

// Loop over input items and add a new field called 'myNewField' to the JSON of each one

const fieldsToDelete = [

for (const item of $input.all()) {
  fieldsToDelete.forEach(field => {
    if (item.json.hasOwnProperty(field)) {
      delete item.json[field];

return $input.all();

However, when running remove columns node (on a subworkflow or on another road), it actually removes the JSON columns on all roads.

Here below I remove columns on the main flow/road but the columns being deleted are also deleted when going in the subworkflow “Create or Update Contact”:


The workflow being very complicated and quite confidential, I can’t share it.

  • **n8n version: 0.236.3 (cloud)

Thanks and regards,

Maybe it is because I am not create a new JSON object and it updates input.all

I believe recreating the JSON object would affect performances more than keeping the columns.

It would be nice to have a remove columns node like we have on the community node (not available for cloud version) “Rename keys advanced” to only keep renamed columns for example.

1 Like

Hey @lequeuxa,

Can you not use a set node and in that put the keys you want to keep that would in theory do the same thing?

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.