Unfortunately messagepack also forces IEEE754 standard for floating point numbers.
That means it is useless for things like money or large/arbitrary precision numbers.
In JSON a number-type value has to be parsed like in javascript, so IEEE754 double.
for example:
{"number": 0.1}
in reality it is parsed as:
{"number": 0.100000000000000005551115123126}
Solely deserialization followed by serialization might introduce a change in serialized value.
Because of problems with IEEE754 in all of our api we use only floats as strings, like {"number": "0.1"}.
For us enforced IEEE754/double format for floating point numbers renders number type near useless.
This is technically correct, except that almost all JSON libraries parse JSON numbers into either 64-bit integer or 64-bit double, so you get those lossy conversions anyway.
I've worked on a production app where we had to swap out the JSON parsing libraries in the server (Rails) and all clients (Android, iOS, Rails again) for ones that preserved numbers as BigDecimals. This was a huge pain, it made everything slower, and even then it wasn't ideal because different BigDecimal libraries aren't even necessarily compatible. Foundation's NSDecimalNumber has different limits than Android's BigDecimal for example, and these are the types used by the parsers so you can't just get the raw data to do it yourself.
If I had to do it over again I would never rely on JSON's decimal support. I'd rather stuff my decimals in strings and parse them myself.
I think you're conflating implementation details of your JSON decoder with the JSON spec. There is no requirement that JSON numbers are parsed into IEEE floats or doubles. Many JSON parsers support decoding numbers into other decimal data types.
In JSON a number-type value has to be parsed like in javascript, so IEEE754 double.
for example:
in reality it is parsed as: Solely deserialization followed by serialization might introduce a change in serialized value.Because of problems with IEEE754 in all of our api we use only floats as strings, like {"number": "0.1"}. For us enforced IEEE754/double format for floating point numbers renders number type near useless.