Json result to array

Hi there,
I am hoping someone can help me.
I have a mysql query thar returns a set of rows/columns but is not returns as an array - is there a way I can do this? Example of my result would be like this:

 {
          "name": "",
          "nodes": [
            {
              "parameters": {},
              "name": "Start",
              "type": "n8n-nodes-base.start",
              "typeVersion": 1,
              "position": [
                250,
                300
              ]
            },
            {
              "parameters": {
                "functionCode": "return [\n  {\n    json: {\n      id: 1,\n      ignoreData: 'whatever1'\n    }\n  },\n  {\n    json: {\n      id: 2,\n      ignoreData: 'whatever2'\n    }\n  }\n]"
              },
              "name": "Mock Data Sheets",
              "type": "n8n-nodes-base.function",
              "typeVersion": 1,
              "position": [
                510,
                300
              ]
            }
          ],
          "connections": {
            "Mock Data Sheets": {
              "main": [
                []
              ]
            },
            "Start": {
              "main": [
                [
                  {
                    "node": "Mock Data Sheets",
                    "type": "main",
                    "index": 0
                  }
                ]
              ]
            }
          },
          "active": false,
          "settings": {}
      }

I would want it to be something like this instead:

{
  "name": "",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n\n    json: {\n      Result:{\n      id: 1,\n      ignoreData: 'whatever1'\n    }\n     }\n  },\n  {\n    json: {\n    Result:{\n      id: 2,\n      ignoreData: 'whatever2'\n    }\n    }\n  }\n]"
      },
      "name": "Mock Data Sheets",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        510,
        300
      ]
    }
  ],
  "connections": {
    "Mock Data Sheets": {
      "main": [
        []
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Mock Data Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {}
}

can anyone assist?

You can do the following:

2 Likes