JSON to Protobuf (.proto) Generator
Start a Protocol Buffers schema from a sample payload instead of writing it by hand.
Use the tool
Why this tool exists
Objects become messages (named from their keys), arrays become repeated fields, integers become int32 or int64 depending on size, other numbers double, booleans bool and strings string. Field names are converted to snake_case and numbered in order. Nulls and empty arrays have no type information, so they are typed as string and noted at the end.
The result compiles with protoc. A sample cannot tell optional from required, enums from strings or timestamps from text, so review the schema before using it on the wire; field numbers must never change once published.
No data is sent anywhere: the work happens in your browser, so you can use it offline once the page has loaded.
How to use it
- Paste a representative JSON object.
- Set the root message and package.
- Copy the .proto output and fix the notes.
- Compile with protoc.
Frequently asked questions
Why are nulls typed as string?
A null reveals no type. Change it to the real type.
How are arrays of objects merged?
Keys from all elements are combined into one message.
Is proto3 the right version?
It is the current default; proto2 features such as required fields are not generated.
Is my data sent anywhere?
No. Everything is processed in your browser, and the page makes no network requests with your input.