Hacker News new | ask | show | jobs
by halflings 4486 days ago
JSON's semantics is that you represent numbers by their decimal representation.

In this particular case, you're giving a different representation, so of course you an pass it as a string.

2 comments

His point was that this number is too large to store it in a Javascript Number variable (which is a IEEE 754 double).
OK, so the provided number format is not sufficient for the kind of numbers he is trying to deal with. So instead you would represent it as a string and handle the encoding/decoding of that number yourself. How is that different from the XML way where there is no provided number format to begin with, and everything is a string?
That's completely irrelevant. Grok the JSON specs and reconsider what the javascript number format has to do with it.
1e99 is valid JSON, that isn't what he is complaining about. See: http://json.org/number.gif