Mangling JSON numbers
TechEmpower
JULY 5, 2016
If we have a long (64-bit integer) that we serialize into JSON, we might be in trouble if JavaScript consumes that JSON. JavaScript has the equivalent of double (64-bit floating point) for its numbers, and double cannot represent the same set of numbers as long. If we are not careful, our long is mangled in transit. Consider 2 53 + 1. We can store that number in a long but not a double.
Let's personalize your content