HTTP nodes suffer from loss of precision in requesting large integer parameters

Describe the problem/error/question

When an HTTP node requests JSON parameters containing large integers, the precision of the parameters is lost
Use the HTTP node POST to request any URL (which can be an n8n internal webhook), with the request parameter body json:
{
“p_id”: 7615917337495251231
}
The parameter values received by the receiving end are inconsistent. If the receiving end is on the n8n webhook, this problem exists on both the sending and receiving ends. It is normal to use curl script to execute the same parameters

What is the error message (if any)?

Please share your workflow


{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
-944,
-80
],
“id”: “4ea59482-facc-49ac-976d-ef24e3e788e6”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“method”: “POST”,
“url”: “http://localhost:8081/test/e49cf8d9-06ac-46f5-8d63-dacb9a25ec43”,
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “={\n"p_id": 7615917337495251231\n}”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.3,
“position”: [
-672,
-80
],
“id”: “79696b2e-3b16-47fe-a30e-ed74390dfe5e”,
“name”: “HTTP Request1”
}
],
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
[
{
“node”: “HTTP Request1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “579791e4d805cb8a7838c0c1981a0ad7632fa38db53a3c01c3b6608b5d3409ba”
}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

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

I think this issue should not be bypassed, such as using strings, because it causes precision loss within the HTTP node, and normal interfaces have parameter type validation, which does not allow numeric types to be transmitted using strings; If external code writing services are needed to be compatible with this issue, the significance of n8n’s workflow will be greatly reduced.We hope that the official can fix the accuracy loss problem of JS as soon as possible, or default to using high-precision JS libraries

1 Like

Hi @lironghai try sending that large number as a STRING as sending it as a INT causes it to loose precision, so sending it as a string would be a better take here using libraries like BigInt , although this should work but let me know if there is some error.

I think HTTP nodes should have internal support, otherwise unexpected problems may arise for users who are not familiar with them; And using string format requires external interface support, but many external interfaces are officially provided and cannot be changed, so I don’t think this is the solution to the fundamental problem

@lironghai yeah that’s fair — raw body only helps on the send side, and if the downstream system is JS-based you still lose precision on parse anyway. for third-party APIs that enforce strict int types you’re stuck, which is exactly why this needs a proper fix at n8n’s JSON layer. the curl comparison you showed is a clean repro case — worth opening a github issue with it

Hey @lironghai, this is actually a JavaScript/JSON limitation, not specific to n8n. Any integer above 2^53 (9007199254740991) loses precision because JS uses IEEE 754 double-precision floats, and JSON.parse() has the same constraint. To properly fix this, n8n would need to use a custom JSON parser with bigint support like json-bigint — worth filing as a GitHub issue since the string workaround won’t work when the downstream API enforces integer types.