Comment on The perils of UUID primary keys in SQLiteparentComments−mort963moAnd then you end up with strings on the other side, not numbers.−sheept3moNo you don't? The example I gave produces {"a":9007199254740993} not {"a":"9007199254740993"}−mort963moOh, that's much worse! The JSON string `{"a":9007199254740993}` decodes to the object `{"a":9007199254740992}` with typical JSON parsers like JavaScript's `JSON.parse`.−sheept3moIf you're applying a replacer, then you'd supply a reviver when parsing: const json = '{ "a": 9007199254740993 }' JSON.parse(json, (_key, value, context) => /^\d+$/.test(context.source) ? BigInt(context.source) : value)−mort963moYeah but now you have the world's biggest foot gun in your API.
Comments
And then you end up with strings on the other side, not numbers.
No you don't? The example I gave produces
notOh, that's much worse! The JSON string `{"a":9007199254740993}` decodes to the object `{"a":9007199254740992}` with typical JSON parsers like JavaScript's `JSON.parse`.
If you're applying a replacer, then you'd supply a reviver when parsing:
Yeah but now you have the world's biggest foot gun in your API.