JSON to Proto Converter
Paste a JSON object and get a Protocol Buffers (proto3) schema with messages, nested types, and repeated fields inferred automatically.
Last updated: May 26, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON to Proto Converter?
Protocol Buffers (protobuf) is Google's language- and platform-neutral schema format for serializing structured data. A `.proto` file declares message types with typed, numbered fields, and the protobuf compiler generates serialization code for many languages. Hand-writing a schema from an existing JSON document is tedious — you have to map each field's name to snake_case, pick the right scalar type, and define nested messages for each sub-object.
This tool automates that initial pass. It parses your JSON, infers the proto type for each field (`bool`, `int32`, `int64`, `double`, `string`), generates a nested message for every nested object, and treats arrays as `repeated` fields. Field names are converted from `camelCase` or `PascalCase` to `snake_case` to follow Protobuf style, and reserved keywords are renamed to avoid syntax errors.
The result is a starting-point schema you can refine — adjust the integer widths, mark fields as optional, add enums, and assign sensible field numbers before finalizing it for production use.
How to Use JSON to Proto Converter
Paste a JSON object (not an array — Protobuf needs a root message).
Set the root message name (defaults to "Root").
The generated .proto schema appears instantly on the right.
Copy the schema or download it as a .proto file.
Review and refine the generated schema — assign proper field numbers, adjust types, and mark fields optional or required as needed.
Common Use Cases
- Bootstrapping a Protobuf schema from a JSON API response.
- Migrating a JSON-based service to a gRPC service.
- Generating an initial .proto file to discuss with a backend team.
- Reverse-engineering the structure of an unknown JSON payload.
- Producing schema documentation for a JSON data exchange.
Example Input and Output
A flat JSON object with mixed scalar types generates a proto3 message with snake_case fields.
{
"userId": 42,
"name": "Alice",
"active": true,
"score": 87.5
}syntax = "proto3";
message Root {
int32 user_id = 1;
string name = 2;
bool active = 3;
double score = 4;
}Privacy
All conversion happens in your browser. No JSON or schema is sent to a server.
Field numbers in production
In real Protobuf usage, field numbers are part of the wire format and must remain stable forever once a schema is in production. Treat the generated numbers as a starting point and assign deliberate numbers before deploying.
Reserved keywords
If a JSON key matches a Protobuf reserved word (message, enum, service, etc.), the field is renamed to `name_field` to avoid a syntax error.
Frequently Asked Questions
How are integers vs floats decided?
Number.isInteger checks the value: integers within int32 range become int32, larger ones become int64, and anything with a decimal becomes double.
What if a JSON array is empty?
The tool defaults to "repeated string" since it cannot infer the element type. Adjust the type manually in the generated schema.
Are field numbers stable across runs?
Field numbers are assigned in the order fields appear in the JSON. If you reorder fields in the JSON, the field numbers change — review them before sharing the schema with anyone deploying the resulting Protobuf.
Does this support oneof, enum, or map?
No. Those concepts cannot be inferred from a single JSON example. Add them manually after the initial schema is generated.
Related Tools
JSON Formatter
Format, validate, and beautify JSON instantly — with clear error messages, Tree View, Diff mode, and Schema validation.
JSON to TypeScript Interface
Convert any JSON object into TypeScript interfaces instantly — handles nested objects, arrays, union types, optional fields, and generics.
JSON to XML Converter
Convert JSON to XML online. Nested objects and arrays are mapped to XML elements with configurable root element name and optional XML declaration.
JSON to CSV Converter
Convert a JSON array of objects to CSV. Flattens nested objects with dot-notation columns and handles arrays within values.
JSON Validator
Validate JSON syntax online. Shows valid/invalid status, error location (line and column), and structure stats including type, key count, and depth.
YAML to JSON Converter
Convert YAML to JSON and JSON to YAML — for config files, CI pipelines, and Kubernetes manifests.

