3 ms·
JSON is one of the most succinct formats that you can use to express an arbitrary data shape of hashes, arrays, and primitives. It is highly useful and covers 9
by Aqueous 3y ago
JSON is one of the most succinct formats that you can use to express an arbitrary data shape of hashes, arrays, and primitives. It is highly useful and covers 99% of cases.
- o11c 3y agoand 1% of the time, it just does the wrong thing. It just silent clobber your data; it might crash your program due to creating an incoherent logic state. Who knows?
- theamk 3y agoThe 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)