Hacker News new | ask | show | jobs
by krispbyte 2586 days ago
Once I was working with a database with large integer ids loading them through json and showing them in the browser. There was a bug where ids didn't match when updating a record. The issue was that the json decoder for Javascript didn't handle large numbers, so an id like 12345678901234567 would show up as 12345678901234568. That was fun to debug.

I wonder if the interpreters will convert between BigInts and small ints automatically now? The backend side was PHP and it did so we never noticed the problem there.

1 comments

This is one reason why people use strings for IDs in JSON, even if they are actually integers.