Closed emiltin closed 3 years ago
This is regards to ECMA standard
From ECMA-404 (2017)
JSON is agnostic about the semantics of numbers. In any programming language, there can be a variety of number types of various capacities and complements, fixed or floating, binary or decimal. That can make interchange between different programming languages difficult. JSON instead offers only the representation of numbers that humans use: a sequence of digits. All programming languages know how to make sense of digit sequences even if they disagree on internal representations. That is enough to allow interchange.
You're right. JSON has only a general number type, integer and float are not defined as types, but of course you can send both integers and floats.
JSON Schema has integer and number: https://json-schema.org/understanding-json-schema/reference/numeric.html. So perhaps it would make sense to use these two in the spec. Note that 1.0 is allowed as in integer (but not 1.5).
also relevant for core
note: this issue does not cover the general use of array, hashes, etc, only numbers
JSON has only integer and float types for numbers, so I think we should stick to these in the specification for messages. Types like long or unsigned integer has no meaning in JSON.
We explicitly state the allowed range anyways.