WebToolsPlanet
Converter Tools

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

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What 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

1

Paste a JSON object (not an array — Protobuf needs a root message).

2

Set the root message name (defaults to "Root").

3

The generated .proto schema appears instantly on the right.

4

Copy the schema or download it as a .proto file.

5

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.

JSON input
{
  "userId": 42,
  "name": "Alice",
  "active": true,
  "score": 87.5
}
Generated .proto
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.