Skip to content
100% local

JSON to Protobuf schema

Turn a JSON sample into a Protocol Buffers .proto message definition.

Input
Output

JSON to Protobuf schema

Paste a JSON sample and this tool infers the shape of your data and writes it out as a Protocol Buffers message definition, ready to drop into a .proto file. It is built for the everyday case of turning an API response, a config object or a log record into a starting schema, instead of typing field numbers and types by hand.

Choose proto3 or proto2 syntax, name the root message, and add a package declaration if your project uses one. Field numbers start at 1 by default and increase by 1 per field, both configurable for a numbering scheme reserved in advance. Arrays become repeated fields, and an object whose values are all one type — a lookup keyed by ID or language code — becomes a map<string, T> instead of a fixed message, so a dictionary field doesn't turn into dozens of named fields. Turn on the optional keyword to mark fields missing or null in part of your sample, and toggle nested messages to keep child types inside their parent rather than as flat top-level siblings. ISO 8601-looking date strings map to google.protobuf.Timestamp, and each field can carry a comment with its original JSON key.

Deeply nested objects, arrays of objects, arrays of arrays and mixed-type fields are all handled: a genuinely mixed-type value falls back to google.protobuf.Value with the matching import added automatically. Malformed JSON is reported with the line and column where parsing failed rather than a generic error.

Everything runs locally in your browser — your JSON is never uploaded anywhere. Copy the generated schema, download it as a .txt file to rename into a .proto, or send the output to another tool to keep working.

FAQ

Does it produce real, compilable .proto syntax?
Yes — the output is plain protobuf message syntax (proto2 or proto3) that you can paste directly into a .proto file. Long-term maintenance, like keeping field numbers stable across schema changes, is still up to you.
How does it decide between a map and a message for an object field?
When every value inside an object is the same scalar type, it's rendered as map<string, T> — the shape a real dictionary has. As soon as an object mixes value types across its keys, it becomes a named message field by field instead.
What happens with a field that has different types across a sample?
It falls back to google.protobuf.Value, with the corresponding import added at the top of the schema. Refine the field type by hand once you've decided which type is authoritative.
Can I number fields starting somewhere other than 1?
Yes — set the start number and the step in the options. Numbering restarts at your chosen start value inside each nested message, matching how protobuf scopes field numbers.
Is my JSON uploaded anywhere?
No. Schema generation runs entirely in your browser — your JSON never leaves your device.