3 ms·
> JSON allows arbitrary integers to be represented as numeric values. What are the practical problems one runs into due to this mechanic? Isn't that just, any
by bruce343434 5y ago
> JSON allows arbitrary integers to be represented as numeric values.
What are the practical problems one runs into due to this mechanic? Isn't that just, any number literal scheme in any language ever?
- thaumasiotes 5y agoMostly they have to do with people believing you can parse JSON `number` elements as if they were JavaScript `Number` types. Like I said, this particular problem is not internal to the definition of JSON.
- Klaster_1 5y agoThe most obvious issue is when numbers in JSON are not parsed correctly by JSON.parse in browsers and you have to use a custom parser or keep numbers as strings, see this SO question https://stackoverflow.com/q/18755125/333777 https://stackoverflow.com/q/18755125/333777. I've encountered this several times when big numbers were serialized in Java, the Swagger said it's just a number and nothing about possible size limit and you eventually faced the issue in one of the bug reports when stuff broke.