Value of floating in JSONValue

Idan Arye via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 21 16:29:55 PDT 2014


On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote:
> I don't think it is a concern as JSON does not encode types. It 
> is up to the receiver how to interpret the data. Here is the 
> output of the program above:
>
> {"value":"1.2345678899999998901"}
>
> Ali

JSON may not encode the very specific type the language that 
created it was using, but it does differ between strings and 
numbers. {"value":"1.2345678899999998901"} is different from 
{"value":1.2345678899999998901}, virtually any JSON 
implementation for any language(there might be exceptions - maybe 
TCL) will parse them to different language constructs, and code 
that expect one may fail, crash or misbehave when given the other.


More information about the Digitalmars-d-learn mailing list