Home → JSON to Protobuf Schema Generator
Convert JSON to Protocol Buffer schema definitions for gRPC systems.
Convert JSON to Protocol Buffer schema definitions for gRPC systems. This tool runs entirely in your browser — no data is ever sent to a server. Free to use, no account required.
Protobuf is Google's binary serialization format — faster and more compact than JSON, but requiring a schema to encode and decode data.
A .proto file defines messages with named, typed, numbered fields. Each field has a type (string, int32, bool, bytes, or another message type) and a unique field number. The schema is compiled by protoc to generate serialization code in your language of choice.
Protobuf is 3–10x smaller than equivalent JSON because field names are replaced by field numbers in the binary encoding, and data types are encoded more efficiently. Parse speed is also 5–10x faster, making Protobuf standard for high-performance internal microservice APIs.
The tool generates a .proto file from your JSON sample, mapping JSON types to appropriate Protobuf field types.
JSON string → string, integer → int32 or int64, float → float or double, boolean → bool, nested object → message, array → repeated field. The tool chooses int32 vs int64 and float vs double based on the magnitude of values in your sample.
Protobuf requires a unique integer field number per field, used in the binary encoding. The tool assigns numbers sequentially starting from 1. Field numbers 1–15 are most efficient and should be used for the most frequent fields.
Protocol Buffers (Protobuf) is Google's binary serialization format — 3-10x smaller and 5-10x faster than JSON. It's the standard format for gRPC APIs and high-performance microservices.
// JSON
{"userId": 1, "name": "Alice", "email": "alice@example.com", "active": true, "score": 98.5}
// Proto3 Definition
syntax = "proto3";
package example;
message User {
int32 user_id = 1;
string name = 2;
string email = 3;
bool active = 4;
double score = 5;
}
| Dataset | JSON Size | Protobuf Size | Savings |
|---|---|---|---|
| 1,000 user records | ~80 KB | ~18 KB | 78% smaller |
| 1M event log records | ~200 MB | ~45 MB | 78% smaller |
| Parse speed (1M records) | ~2.1s | ~0.3s | 7x faster |
| JSON Type | Proto3 Type | Notes |
|---|---|---|
| string | string | |
| integer (small) | int32 | |
| integer (large) | int64 | |
| float (32-bit) | float | |
| float (64-bit) | double | |
| boolean | bool | |
| array | repeated Type | |
| nested object | message | Define separate message |
| nullable | optional Type | Proto3 optional keyword |
Explore more tools: All JSON Tools | Validator | Pretty Print | JSON Diff
Every JSON value type maps to one or more Protobuf scalar or composite types. Choosing the right type matters: using int32 for a Unix timestamp that exceeds 2,147,483,647 will silently truncate data. Always use int64 for epoch milliseconds, IDs, and any number that may grow large.
| JSON Type | Protobuf Type | Notes |
|---|---|---|
| string | string | Direct mapping |
| integer | int32 / int64 | Use int64 for large numbers |
| float | float / double | Use double for precision |
| boolean | bool | Direct mapping |
| null | optional / oneof | No direct null in proto3 |
| array | repeated | repeated string tags = 4; |
| object | message | Nested message definition |
Given the JSON input {"name":"Alice","age":30,"email":"alice@example.com","active":true}, the converter produces:
syntax = "proto3";
package example;
message User {
string name = 1;
int32 age = 2;
string email = 3;
bool active = 4;
}
Protobuf is a binary encoding format designed for high-throughput, low-latency scenarios such as gRPC services, Kafka message queues, and mobile apps with limited bandwidth. JSON prioritizes human readability and universal tooling support. Use JSON for public APIs and configuration files; use Protobuf when performance or payload size is the bottleneck.
| Aspect | JSON | Protobuf |
|---|---|---|
| Human readable | Yes | No (binary) |
| File size | Baseline | 3–10x smaller |
| Parse speed | Baseline | 5–10x faster |
| Schema required | No | Yes (.proto file) |
| Language support | Universal | Most major languages |
| Debugging | Easy (text) | Harder (needs schema) |
| Best for | Web APIs, configs | gRPC, Kafka, high-performance systems |