3 ms·
The rule is pretty simple: if you have fields which may potentially contain integers with outside of +-2*48 range, or floating points where you care about NaNs
by theamk 3y ago
The rule is pretty simple: if you have fields which may potentially contain integers with outside of +-2*48 range, or floating points where you care about NaNs -- then do the safe thing and store them as strings.
That one simple rule ensures your data won't be clobbered and you program won't crash.
(And yes, your serialization/deserialization code will need to contain explicit string conversions. But even with that extra conversion, Javascript is way more interoperable with anything and future-proof than any alternative like protobuf or msgpack)