CBOR and MessagePack are both binary equivalents to JSON. They use the same data structure as JSON, so they are fully compatible with JSON, but because they are binary the formats are smaller and faster to compress and decompress. The main reason not to use them is because browsers have native support for deserializing JSON (i.e. JSON.parse
). This code is native to the browser and highly optimized. To deserialize CBOR or MessagePack you have to use JavaScript libraries which are not as efficient as native code.
So, my proposal is to add full support for CBOR and/or MessagePack at the native browser level. You would have CBOR.encode
and CBOR.decode
methods (or msgpack.decode
and msgpack.encode
) just as we have JSON.stringify
and JSON.parse
.
I think that this would provide a significant improvement in transmission and encoding/decoding speed.