Urgent.News

What's breaking now, across thousands of outlets.

Editions

Tech

We Built Guardrails Against JSON Precision Loss. Then We Found Out Half of Them Weren't Actually Guarding Anything.

A few weeks ago I ran this through our own JSON repair tool, in the browser, on our own website: json { "id" : 22233344455566677788 } It came back as: json { "id" : 22233344455566676000 } No error. No warning. Just a quietly wrong number, presented as a successful repair. That number is a made-up snowflake ID, the kind of thing you'd see as a primary key in a distributed system. And our own tool…

A JSON repair tool, designed to prevent incorrect results, silently corrupted a made-up snowflake ID during testing. This issue occurs because JSON has only one number data type, which JavaScript also uses, and cannot distinguish between integers and floats. Once a number is parsed into a JavaScript Number, its original precision is lost, and there's no way to reconstruct it.

Systems like Twitter and Stripe have addressed this by providing both numeric and string IDs, while pandas has had unresolved issues with JSON.mangling large integers. The JSON repair tool the company built had a guard to reject requests with non-precise numbers, but it wasn't implemented in the browser client versions. After testing, they discovered that three out of four browser pages let oversized numbers pass through.

They had designed the large-integer check to be non-blocking, logging the error instead of rejecting the request, but decided to change it to reject before parsing, ensuring no precision loss. Now, the server and browser tools both check for large integers and reject requests with non-precise numbers, providing a clear error message instead of a silently corrupted result.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How Java's Concurrency APIs Fit Together

A concurrency problem can begin with an ordinary requirement: let two independent operations make progress without forcing one to wait for the other. The requirement is easy to state.

A hacked game. Billions in losses

O maior segredo da história da indústria de games vazou – e a empresa responsável pelo desenvolvimento do produto perdeu mais de US$ 2 bilhões em valor de mercado por conta da falha de segurança.

  • Hack exposes GTA VI details, causing $2B market loss
  • GTA VI pre-sold 4.38M copies before official reveal
  • Hacker claims complete, playable version, threatens free launch

Learn what VCs actually want, from a founder who’s raised $1B

Investors want founders who understand the financial reality of their business. Messy data, misunderstood metrics, or waiting until you’re nearly out of cash to start fundraising can cost founders…

  • VCs prioritize founders with a clear understanding of their business's financial reality.
  • Essential financial metrics include fundraising readiness and data room preparedness.
  • Financial house in order boosts founders' confidence and leverage during fundraising.

More from Thursday 20 August →