Twitter Added id_str in 2010 Because JavaScript Can't Hold a Java long
Book: Kotlin and Java to TypeScript Also by me: The TypeScript Library — the 5-book collection My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub On October 18, 2010, Twitter told every developer on its API that tweet IDs were about to change shape. A new generator called Snowflake would produce 64-bit IDs, and…
On October 18, 2010, Twitter informed developers that tweet IDs would change from 53-bit numbers to 64-bit IDs. This change necessitated the inclusion of a string version of each ID to accommodate JavaScript's limitation in representing the larger IDs. The result is the addition of the `id_str` field in the API, which is still present today.
Despite the widespread use of this field, it still causes issues when transferring IDs between the server and client, resulting in 404 errors or incorrect data being saved on the server. This issue arises due to JavaScript's inability to accurately represent the larger 64-bit IDs, resulting in rounding errors when the IDs are parsed back into numbers.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.