3 ms·
Is the good reason that parsers are doing this in the first place? To me, it sounds like a practice/implementation that necessitates a second layer of parsing.
by imoverclocked 2mo ago
Is the good reason that parsers are doing this in the first place? To me, it sounds like a practice/implementation that necessitates a second layer of parsing. If so, then maybe JSON is not the optimal medium to be using for the data being distributed.
- craftkiller 2mo agoThe parsers doing this in the first place is the problem. The JSON spec doesn't specify how numbers should be stored/interpreted, so theoretically you could have a 2,000 bit integer in JSON. The lack of clarity around that could also be considered a flaw in the JSON spec. But from a practical standpoint, the most common JSON parser is in web browsers running javascript, and they'll parse to double-precision floats. So from a practical standpoint, if you don't want your numbers distorted, you need to be defensive about it and encode your numbers as strings (or use something other than JSON).