r/programming • • Jul 12 '26 • Bravo 1

Prefer STRICT tables in SQLite

https://evanhahn.com/prefer-strict-tables-in-sqlite/
358 Upvotes

108 comments sorted by

View all comments

Show parent comment

10

u/busyHighwayFred Jul 12 '26

Json does differentiate between numbers and text though?

5

u/taw Jul 12 '26

JSON typing is total BS too, people just ignore it.

Like if you load {"x": 2} and {"x": 2.0} in Javascript, they're considered completely equivalent.

But if you load it into Python or Ruby, you get completely different types for first and second example!

You get nonsense like some JSON libraries converting language's native big integer type to JSON strings, as that's the only way to ensure they won't get mutilated on the way, as anything in JSON processing chain can randomly decide to force numbers down to double precision floats.

And Javascript has native bigints, but they raise TypeError: Do not know how to serialize a BigInt.

JSON spec doesn't even try to address it.