Removing a column name from json object without using Set node

Hi, I have an output like this:

I need to remove the column “v” on each item.
I know this can be done via Set using the Keep only set option and adding the others as string.

I am receiving more than 15 column names from a workflow and needed to to it in a simple and easy way. Could there be a Function to that. Thanks.

Just add a function item node afterward with the following code.

delete item.v
return item;
Example workflow
2 Likes

Thanks so much :slight_smile: :slight_smile:

Is there an updated version of this for the new function node? It doesn’t work for me.

1 Like

Hi, I just came across this issue, and found a solution, I don’t know if you still need it, but here it goes anyway :smile:

This uses the latest Code Node with the option “Run Once for All Items”

// Delete unnecessary columns
for (const item of $input.all()) {
  delete item.json.FieldToRemove;
}
return $input.all();

Hope it helps.
Nice day :smile:

2 Likes

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