256
Surely "1337" is the same as 1337, right?
(sopuli.xyz)
Post funny things about programming here! (Or just rant about your favourite programming language.)
Correct, JSON can handle any precision, because it's just dumped as a string anyway, just not enclosed in the
""
. However, as you mentioned, as soon as it comes through the parser it'll put it into an underlying float value. In C# I create a save high precision attribute that will take the value and put it directly into adecimal
. In JS I'm sure there's some way to do that, but that parser is way less extensible compared to C#. However, this also all assumes you know the client will parse it correctly, overriding the default behavior. Safest is to just send it as a string, and then create your parsers to automatically send to and from strings