JavaScript `JSON.parse()` Silently Rounded 64-Bit Integer IDs (`> 2^53 - 1`)
IEEE 754 `Number.MAX_SAFE_INTEGER` (9007199254740991) truncates 64-bit Snowflake/Twitter/DB IDs.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: JavaScript `JSON.parse()` Silently Rounded 64-Bit Integer IDs (`> 2^53 - 1`)
Platform: Data
Common Root Causes:
- IEEE 754 `Number.MAX_SAFE_INTEGER` (9007199254740991) truncates 64-bit Snowflake/Twitter/DB IDs.
Interactive Diagnostic Checklist
Verified Solutions:
- Serialize 64-bit integer IDs as JSON strings (`"id": "1234567890123456789"`) in API responses.
Safe Diagnostic Command:
Compare raw JSON response text vs parsed JS number
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
IEEE 754 `Number.MAX_SAFE_INTEGER` (9007199254740991) truncates 64-bit Snowflake/Twitter/DB IDs. Recommended diagnostic: `Compare raw JSON response text vs parsed JS number`. Remediation: Serialize 64-bit integer IDs as JSON strings (`"id": "1234567890123456789"`) in API responses.
Worked Examples
- Run `Compare raw JSON response text vs parsed JS number` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-data-json-large-int64-precision-loss · Independently verified: 2026-11-25