{"id":1513,"date":"2026-11-21T18:00:00","date_gmt":"2026-11-21T18:00:00","guid":{"rendered":"https:\/\/wade.one\/blog\/?p=1513"},"modified":"2026-11-21T18:00:00","modified_gmt":"2026-11-21T18:00:00","slug":"large-json-ids-should-survive-the-trip-to-the-browser","status":"publish","type":"post","link":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/","title":{"rendered":"Large JSON IDs Should Survive the Trip to the Browser"},"content":{"rendered":"<p>An identifier should come back from the browser with the same digits it had when it left the server. That is a fairly modest requirement, but a large database integer sent as a JSON number can make it surprisingly easy to break. The value can be valid in storage and valid JSON while a client represents it imprecisely.<\/p>\n<p>The <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc8259.html#section-6\">JSON specification&#8217;s number guidance<\/a> identifies the integer range from -9,007,199,254,740,991 to 9,007,199,254,740,991 as exactly interoperable for implementations using common binary64 number handling. JavaScript&#8217;s ordinary number representation has that safe-integer boundary. A backend using 64-bit integers can therefore accept identifiers outside the range a typical browser client safely handles as numbers.<\/p>\n<p>For an opaque ID that might exceed that boundary, I prefer a string in the API contract. The client needs to keep it, compare it and send it back; arithmetic is usually irrelevant. Make that decision before the large values arrive and carry it through schemas, generated clients, URLs and stored frontend state. Converting the parsed number into a string afterwards cannot recover digits that have already been lost. A special parser may preserve them, but every consumer then needs to understand that arrangement.<\/p>\n<p>I would test one identifier above the safe-integer boundary through the actual serializer and client parser, then check the value sent on a subsequent request. Small fixture IDs will never show this problem. If an existing API needs changing, treat the move from number to string as a contract change and plan for its consumers. It is an annoying detail to discover late, especially when the screen still displays something that looks perfectly reasonable.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An identifier can be stored correctly in the database and still lose precision on its way through a JavaScript client.<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[13],"tags":[66,135,338],"class_list":["post-1513","post","type-post","status-publish","format-standard","hentry","category-programming","tag-api","tag-javascript","tag-json"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Large JSON IDs Should Survive the Trip to the Browser - wade.one<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Large JSON IDs Should Survive the Trip to the Browser - wade.one\" \/>\n<meta property=\"og:description\" content=\"An identifier can be stored correctly in the database and still lose precision on its way through a JavaScript client.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/\" \/>\n<meta property=\"og:site_name\" content=\"wade.one\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-21T18:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/Wade-Logo-cropped.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1518\" \/>\n\t<meta property=\"og:image:height\" content=\"1506\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wadewomersley\" \/>\n<meta name=\"twitter:site\" content=\"@wadewomersley\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Large JSON IDs Should Survive the Trip to the Browser\",\"datePublished\":\"2026-11-21T18:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/\"},\"wordCount\":278,\"publisher\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\"},\"keywords\":[\"api\",\"javascript\",\"json\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/\",\"name\":\"Large JSON IDs Should Survive the Trip to the Browser - wade.one\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#website\"},\"datePublished\":\"2026-11-21T18:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/2026\\\/11\\\/21\\\/large-json-ids-should-survive-the-trip-to-the-browser\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wade.one\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Large JSON IDs Should Survive the Trip to the Browser\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/\",\"name\":\"wade.one\",\"description\":\"wade womersley - york based software engineer\",\"publisher\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wade.one\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/#\\\/schema\\\/person\\\/8b4739f8f8bb2cff5d792d4b8779fcc3\",\"name\":\"Wade Womersley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"url\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"contentUrl\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\",\"width\":202,\"height\":200,\"caption\":\"Wade Womersley\"},\"logo\":{\"@id\":\"https:\\\/\\\/wade.one\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/200px.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Large JSON IDs Should Survive the Trip to the Browser - wade.one","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/","og_locale":"en_GB","og_type":"article","og_title":"Large JSON IDs Should Survive the Trip to the Browser - wade.one","og_description":"An identifier can be stored correctly in the database and still lose precision on its way through a JavaScript client.","og_url":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/","og_site_name":"wade.one","article_published_time":"2026-11-21T18:00:00+00:00","og_image":[{"width":1518,"height":1506,"url":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/Wade-Logo-cropped.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@wadewomersley","twitter_site":"@wadewomersley","twitter_misc":{"Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/#article","isPartOf":{"@id":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/"},"author":{"name":"","@id":""},"headline":"Large JSON IDs Should Survive the Trip to the Browser","datePublished":"2026-11-21T18:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/"},"wordCount":278,"publisher":{"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3"},"keywords":["api","javascript","json"],"articleSection":["Programming"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/","url":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/","name":"Large JSON IDs Should Survive the Trip to the Browser - wade.one","isPartOf":{"@id":"https:\/\/wade.one\/blog\/#website"},"datePublished":"2026-11-21T18:00:00+00:00","breadcrumb":{"@id":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wade.one\/blog\/2026\/11\/21\/large-json-ids-should-survive-the-trip-to-the-browser\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wade.one\/blog\/"},{"@type":"ListItem","position":2,"name":"Large JSON IDs Should Survive the Trip to the Browser"}]},{"@type":"WebSite","@id":"https:\/\/wade.one\/blog\/#website","url":"https:\/\/wade.one\/blog\/","name":"wade.one","description":"wade womersley - york based software engineer","publisher":{"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wade.one\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/wade.one\/blog\/#\/schema\/person\/8b4739f8f8bb2cff5d792d4b8779fcc3","name":"Wade Womersley","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","url":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","contentUrl":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png","width":202,"height":200,"caption":"Wade Womersley"},"logo":{"@id":"https:\/\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/200px.png"}}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1470,"url":"https:\/\/wade.one\/blog\/2026\/10\/27\/verify-webhook-signatures-before-parsing-away-the-evidence\/","url_meta":{"origin":1513,"position":0},"title":"Verify Webhook Signatures Before Parsing Away the Evidence","author":"","date":"October 27, 2026","format":false,"excerpt":"A webhook can contain perfectly sensible JSON and still fail signature verification.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1502,"url":"https:\/\/wade.one\/blog\/2026\/11\/16\/missing-and-null-need-different-rules-in-a-patch-api\/","url_meta":{"origin":1513,"position":1},"title":"Missing and Null Need Different Rules in a PATCH API","author":"","date":"November 16, 2026","format":false,"excerpt":"Leaving a field out and deliberately clearing it are different requests. A partial-update endpoint needs to preserve that distinction.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":764,"url":"https:\/\/wade.one\/blog\/2015\/02\/07\/standardising-logging-and-parallelisation-in-multiple-languages\/","url_meta":{"origin":1513,"position":2},"title":"Standardising logging and parallelisation in multiple languages","author":"Wade","date":"February 7, 2015","format":false,"excerpt":"Over the last few days I've been working on interfaces to use across multiple programming languages to standardise how some things are done. This stemmed from a requirement to allow processing to be dealt with in any language from any other language. People do this all the time, it's nothing\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/source-code-583537_640.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/source-code-583537_640.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/wade.one\/blog\/wp-content\/uploads\/2015\/02\/source-code-583537_640.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1393,"url":"https:\/\/wade.one\/blog\/2026\/08\/14\/ai-coding-tools-need-the-same-policy-everywhere\/","url_meta":{"origin":1513,"position":3},"title":"AI Coding Tools Need the Same Policy Everywhere","author":"","date":"August 14, 2026","format":false,"excerpt":"Coding-agent governance only works when the same rules follow developers across every client and cloud task.","rel":"","context":"In &quot;Software Engineer&quot;","block_context":{"text":"Software Engineer","link":"https:\/\/wade.one\/blog\/category\/software-engineer\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1503,"url":"https:\/\/wade.one\/blog\/2026\/11\/13\/optimistic-locking-stops-an-old-tab-overwriting-new-work\/","url_meta":{"origin":1513,"position":4},"title":"Optimistic Locking Stops an Old Tab Overwriting New Work","author":"","date":"November 13, 2026","format":false,"excerpt":"Two people can save valid changes and still overwrite each other. A version check gives the application a chance to catch it.","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":437,"url":"https:\/\/wade.one\/blog\/2010\/01\/31\/mysql-and-binary16-the-reasonsbenefitsdrawbacks-mysql\/","url_meta":{"origin":1513,"position":5},"title":"MySQL and Binary(16) &#8211; The Reasons\/Benefits\/Drawbacks (#mysql)","author":"Wade","date":"January 31, 2010","format":false,"excerpt":"I recently posted an article about using BINARY(16) for storing MD5's as unique identifiers instead of simple integer ID's (usually auto increment); in that article I touched on one of the benefits, reducing JOIN's, but there are other reasons for doing it too, so I thought I'd post an article\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/wade.one\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/comments?post=1513"}],"version-history":[{"count":1,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1513\/revisions"}],"predecessor-version":[{"id":1528,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/posts\/1513\/revisions\/1528"}],"wp:attachment":[{"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/media?parent=1513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/categories?post=1513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wade.one\/blog\/wp-json\/wp\/v2\/tags?post=1513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}