Skip to content
BENIBIX Learn

JSON vs Protocol Buffers

People think Protobuf is just a faster JSON, and it is not. JSON carries its own field names, so anyone can read it with no setup. Protobuf sends only numbered fields as bytes. Both sides need the same .proto file to make sense of them. You trade easy reading for small, fast messages.

Development📄 Files & Formats

JavaScript Object Notation (JSON)

A plain text format for data, made of names and values. Most APIs use it.

JSON is a plain text way to write down data so programs can swap it. It uses names and values in curly brackets, like "age": 36. It can hold text, numbers, true or false, null, lists and nested groups. Almost every language can read and write it. Most web APIs send and receive their data as JSON.

Example
Jack's app asks a weather API for London. The reply is JSON with the temperature, the wind and the chance of rain.
Why it matters
JSON is the common language of the web. If two programs talk, it is very likely in JSON.
Full entry
Development📄 Files & Formats

Protocol Buffers (Protobuf)

A compact way to send data as bytes. It is smaller and faster than JSON.

Protocol Buffers is a format from Google for sending data as compact bytes. You first describe the data in a .proto file. A tool turns that file into code for your language. That code packs data into small bytes and unpacks it again. It works like JSON, but it is smaller and faster to read. The catch is that people cannot read the bytes.

Example
Two services in an online shop talk thousands of times a second. They send Protobuf, so each message is small and quick to read.
Why it matters
At high volume, smaller messages save time and money. It is also the format that gRPC sends.
Full entry

In one line

JavaScript Object Notation (JSON)
A plain text format for data, made of names and values. Most APIs use it.
Protocol Buffers (Protobuf)
A compact way to send data as bytes. It is smaller and faster than JSON.