Son
Son copied to clipboard
Son inherits the weakness of JSON by not specifying the numeric value ranges
This is a dark spot of JSON. JavaScript uses double float to represent integers. So not all 64bit integers can be represented in javascript. Some JSON encoder/decoder have inherited this limitation but JSON doesn't specify the numeric value ranges.
SON inherits the same weakness by not specifying the value ranges.
If you want to specify a data encoding for machine to machine communication which allows to garantee interoperability, you have to specify the value ranges so that we know if it's ok to use double float to represent integer values.
Great question. Specifying ranges for numbers is absolutely within the scope of Son, if we want to do it.
Since correct decoding to floats relies not just on the size of the number, but also how many digits it has, I'm not sure how to do this though.