When JSON is too expensive
JSON is verbose, slow to parse, and unable to represent floats compactly. For high-frequency numerical data — game state at 60fps, market ticks at 100Hz, sensor streams — the JSON tax shows up as bandwidth costs and dropped frames. Two binary formats dominate: MessagePack (drop-in, schema-less) and Protocol Buffers (compact, schema-required).
MessagePack: JSON-shaped, smaller, faster
MessagePack encodes the same JSON-ish structures (objects, arrays, numbers, strings, booleans, null) into ~30% smaller binary frames with much faster parse. No schema definition needed. Reach for it first when JSON costs too much.
Protocol Buffers: schema-driven, smallest
Protobuf requires a .proto schema and code generation, but produces 60% smaller payloads with the fastest parse. Schemas double as documentation and version control. Worth the setup when your protocol stabilizes and the data volume justifies it.