Need Assitance on Looping

Hi,
I’m trying to build an workflow for orchestrating the SDK integration,
So we are fetching the data from an 3rd party application, which sends users data, The problem i’m enduring now is with the loop over item or i would recommend someone to help me how to orchestrate further,
Our SDK Integration Upload data supports only 1000 records/transaction per upload, but the API call has more than 1000+ user records, I have used Split out and set fields to customize the payload and I’m getting all user records as one item via the Aggregate node, I tried using loop node as well but same behavior. Can someone advice me how to orchestrate further to make sure we upload all the user data before finishing the sync?

({
  "nodes": [
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {
          "includeBinaries": false
        }
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        1648,
        208
      ],
      "id": "8c943f6a-3fcf-4148-b27b-4a38bfd5e58a",
      "name": "Aggregate"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api-ext.zluri.com/v2/integrations-sync/syncs/6/snapshot-data",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "api-key",
              "value": "X"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "=json",
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "jsonBody": "={\n  \"entity_name\": \"users\",\n  \"page\": 1,\n  \"data\":{{ $json.data }}\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2176,
        224
      ],
      "id": "59d75725-2b9c-4044-b5a5-3dbf537d6ec1",
      "name": "Upload data"
    },
    {
      "parameters": {
        "method": "PUT",
        "url": "=https://api-ext.zluri.com/v2/integrations-sync/syncs/690a21c8efd4de8c8f545e59/finish",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "api-key",
              "value": "
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2336,
        -32
      ],
      "id": "29546295-be68-4194-8224-2b84df8f61b6",
      "name": "Finish syncing"
    },
    {
      "parameters": {
        "batchSize": "={{ $json.data }}",
        "options": {
          "reset": false
        }
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1904,
        192
      ],
      "id": "948f6bd0-8a8b-48ee-8853-384a4f58a90e",
      "name": "Loop Over Items",
      "alwaysOutputData": true
    }
  ],
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Finish syncing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "187d77fad0df17aa162da112044455fb2b82f4d4391b5f0baebde5e262eb1754"
  }
}

Share the output returned by the last node

{
“errorMessage”: “JSON parameter needs to be valid JSON”,
“errorDetails”: {},
“n8nDetails”: {
“nodeName”: “Upload data”,
“nodeType”: “n8n-nodes-base.httpRequest”,
“nodeVersion”: 4.2,
“itemIndex”: 0,
“time”: “11/9/2025, 3:34:16 PM”,
“n8nVersion”: “1.115.1 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeOperationError: JSON parameter needs to be valid JSON”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts:430:15)“,
" at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1093:31)”,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1274:22)“,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1676:38”,
" at processTicksAndRejections (node:internal/process/task_queues:105:5)“,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2292:11”
]
}
}

Information on your n8n setup

  • n8n version: latest
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system: Macos

Hello @Vikram_Senthil

The error message indicates that there’s an issue with JSON:


Try using this instead:

{{ $json.data.toJsonString() }}

Also, in the loop settings the batch size should be a number:

image