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.

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  },\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  },\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  },\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  }\n  \n]\n"
      },
      "name": "Set Example Data1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        0,
        830
      ]
    }
  ],
  "connections": {}
}

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
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  },\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  },\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  },\n  {\n    json: {\n      id: 200,\n      i:2,\n      x:3,\n      v:5,\n      c:7,\n      b:9\n    }\n  }\n  \n]\n"
      },
      "name": "Set Example Data1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Code here will run once per input item.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.functionItem\n\n// Add a new field called 'myNewField' to the JSON of the item\ndelete item.v\n\n// You can write logs to the browser console\nconsole.log('Done!');\n\nreturn item;"
      },
      "name": "FunctionItem",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        720,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set Example Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Example Data1": {
      "main": [
        [
          {
            "node": "FunctionItem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
2 Likes

Thanks so much :slight_smile: :slight_smile: