Menu

1 / 2

devto-post-1-precision

DEV Community: javascript·xushoulin·4 days ago
#WrXDj7Z2
#devtojavascript#devto#dev#json#order
Reading 0:00
15s threshold

---

title: "\"Your 19-digit ID is a different number after JSON.parse\" "

published: false

description: "\"RFC 8259 puts no size limit on numbers. JavaScript has exactly one numeric type. What that costs, measured on Node 22.\" "

tags: javascript, json, webdev, api

canonical_url: https://www.shoulin.shop/guides/why-json-numbers-lose-precision

---

A support ticket I keep seeing, in various disguises: "the ID changed after we formatted the JSON." It didn't change because of the formatter. It changed the moment the document was parsed, before any tool could intervene.

Here is the whole failure in one line:

JSON . parse ( ' {"id":9007199254740993} ' ). id // 9007199254740992

Enter fullscreen mode

Exit fullscreen mode

Nothing was malformed. The container was too small.

The spec allows it; the runtime does not

RFC 8259 does not put a size limit on numbers.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.