Binary Serialization Formats
Compare MessagePack, Protocol Buffers, and CBOR directly against JSON on the same real payload — encoding, decoding, inspecting the raw bytes, and benchmarking size and speed to understand exactly what a binary format buys you and what it costs.
Prerequisites: completion of Character Encoding and Unicode; Python 3 with pip; comfort with basic JSON.
Sourcing & version notes: verified against the MessagePack specification (msgpack.org), RFC 8949 (CBOR, an IETF Internet Standard since 2020), and current Protocol Buffers documentation. Protobuf now organizes its language versioning around "Editions" (2023 and 2024 are current; annual releases are planned going forward) rather than the older proto2/proto3 syntax labels, though proto3 syntax remains fully supported, is what the vast majority of existing real-world .proto files and tutorials use, and is what this project uses for its hands-on steps — the wire format and binary compatibility are identical regardless of which syntax generated the code. The Python protobuf package and grpcio-tools (for the protoc compiler via pip) are both actively maintained and current as of mid-2026.
JSON is a completely reasonable default for most data interchange — human-readable, universally supported, and simple enough to have essentially no learning curve. But it has real, mechanical costs that become significant at scale: every value is text, so a number like 1000000 costs 7 bytes instead of the 4 (or fewer) it would need as an actual binary integer; every key name in every object repeats in full, every single time, even in an array of ten thousand structurally identical records; and parsing text into typed values (figuring out where a number starts and stops without knowing its length in advance) is measurably slower than reading a fixed number of bytes off the wire.
Binary serialization formats exist to eliminate these specific costs, and they take genuinely different design approaches to doing it. This project covers three real ones — MessagePack (schemaless, drop-in JSON replacement), Protocol Buffers (schema-defined, code-generated), and CBOR (an IETF-standardized, self-describing binary format) — encoding and inspecting the same payload in each, so the tradeoffs are things you've measured rather than just read about.
MessagePack: JSON's data model, encoded as bytes
Protocol Buffers: a schema changes everything
CBOR: a standards-track alternative built for extensibility
Choosing a format: schema evolution is the real deciding factor
Secret Mission: benchmark all four on a realistic payload
Before You Go
Test what you just learned
Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.
Log in to unlock0 / 7 complete
