Networking & Protocols (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What are Protocol Buffers (Protobuf) and why are they smaller than JSON?
senior LevelCode ExampleSystem DesigngRPC
In Simple Words: Google's language-neutral, binary serialization mechanism:
- In JSON, field names like
"customer_email_address"are serialized as literal ASCII characters on every single message. - In Protobuf, fields are declared with small integer field tags:
protobuf
message User { int32 id = 1; string email = 2; } - Serialized to compact binary bytes using varints and tag-length-value encoding, producing payloads that are 60-80% smaller than JSON with 10x faster parsing speeds.