Hello Wendy, W dniu 2015-10-27 o 19:37, Wendy Roome pisze:
Note that JSON does not distinguish between integers and floating point, and in the JSON libraries I've seen, numbers are always floating point. When parsing JSON, libraries do not distinguish between 1 and 1.0. When generating JSON, most libraries will generate 1, but a library could generate 1.0.
Indeed, it may be an important issue in some specific use-cases. AFAIR if you have a Long field and (de)serialize it in Jackson (most popular Java JSON library), everything will work properly as data types are perfectly known. But if you switch to JavaScript, where all numbers are double-precision fp by definition, you won't be able to store an exact value lying outside the range [-(2^53)+1, (2^53)-1].
And as you've stated, a library may (non-intentionally) produce a map not conforming to JSON schema by generating `integers' like 1.0 or 1e2. (JSON schema differentiates "integer" and "number".) Such a map should be droppped by a client on validation or deserialization stages.
Best regards, Piotr 'GhosT' Wydrych -- Piotr 'GhosT' Wydrych .. xmpp:wydrych//agh.edu.pl .. http://wydrych.net/ A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? _______________________________________________ alto mailing list [email protected] https://www.ietf.org/mailman/listinfo/alto
