Protobuf to JSON Schema
Convert proto3 definitions to JSON Schema, TypeScript interfaces, and sample JSON. Supports messages, enums, nested types, oneof, map, repeated.
Updated
Protobuf to JSON Schema
Convert Protocol Buffer (proto3) definitions to JSON Schema, TypeScript interfaces, and sample JSON. Paste your .proto file and get instant, accurate conversions.
Protobuf Input
Frequently Asked Questions
What is the Protobuf to JSON Schema?
The Protobuf to JSON Schema is a free online tool that convert proto3 definitions to json schema, typescript interfaces, and sample json. supports messages, enums, nested types, oneof, map, repeated.. It runs entirely in your browser with no installation or sign-up needed.
What features?
Proto3: messages, enums, nested messages, repeated, optional, oneof, map fields, all scalar types.
Output formats?
Three: JSON Schema (Draft-07 with $ref), TypeScript interfaces, and sample JSON with placeholder values.
How are int64 types handled?
Mapped to string in both JSON Schema and TypeScript, following the standard protobuf JSON mapping convention for 64-bit integers.
Is the Protobuf to JSON Schema free to use?
Yes, the Protobuf to JSON Schema is 100% free with no registration, no hidden fees, and no usage limits. All processing happens locally in your browser, ensuring complete privacy.
Is my data safe with this tool?
Absolutely. The Protobuf to JSON Schema processes everything client-side in your browser. No data is uploaded to or stored on any server. Your content remains private on your device at all times.
Does the Protobuf to JSON Schema work on mobile devices?
Yes, the Protobuf to JSON Schema is fully responsive and works on smartphones and tablets. You can use it on any device with a modern web browser -- no app download required.
Do I need to create an account to use this tool?
No account or registration is needed. Simply open the Protobuf to JSON Schema in your browser and start using it immediately. There are no sign-up walls or usage restrictions.
What programming languages or formats does this support?
The Protobuf to JSON Schema supports a wide range of popular formats and languages. Check the tool interface for the full list of supported options.
How do I use the Protobuf to JSON Schema?
Simply enter your input in the provided field, adjust any settings to your preference, and the tool will process it instantly. You can then copy the result to your clipboard or download it.
What is the difference between a .proto file and a JSON Schema?
A .proto file is the source definition for Protocol Buffers: it declares messages, fields, types, and field numbers used to serialize compact binary data for gRPC and high-throughput APIs. A JSON Schema describes the shape of a JSON document so validators can check that incoming or outgoing payloads have the right fields and types. They serve the same idea -- a data contract -- but in different worlds: protobuf governs binary wire format, while JSON Schema governs human-readable JSON used in web APIs, configs, and docs. Converting one to the other lets you validate JSON against the same structure your services already enforce in binary. This tool reads a proto3 definition and emits a Draft-07 JSON Schema, using $ref pointers into a shared definitions block, so you can drop it straight into a validator without rewriting field names by hand.
Why are int64 values shown as strings instead of numbers in the JSON output?
Sixty-four-bit integer types -- int64, uint64, sint64, fixed64, and sfixed64 -- are represented as strings rather than numbers in both the JSON Schema and the sample JSON. This is not a quirk of the converter; it follows the official Protobuf JSON mapping. JavaScript's number type is a double-precision float that can only safely represent integers up to 2^53, so a true 64-bit value could silently lose precision if parsed as a number. Encoding it as a string preserves every digit and round-trips cleanly across languages. Thirty-two-bit integers like int32 and uint32 stay as plain numbers, since they fit comfortably. Knowing this prevents validation surprises when a backend sends a large ID or timestamp. Paste your schema here and the tool applies the string-versus-number rule automatically for every numeric field.
How are repeated, map, and oneof fields converted to JSON Schema and TypeScript?
Each protobuf construct maps to its natural JSON equivalent. A repeated field becomes a JSON array and a TypeScript array type, since it holds zero or more values. A map<key, value> field is rendered as a JSON object using additionalProperties to type the values, because protobuf maps are key-value collections. A oneof block emits every member field, and the JSON Schema records that the options are mutually exclusive, so only one can be set at a time. Optional fields become non-required in the schema and gain a ? in the TypeScript interface, while scalar and nested message types resolve through $ref pointers. This means complex real-world schemas translate faithfully rather than being flattened or dropped. Click Sample .proto to load an example that includes a repeated field, a map, and a oneof, then compare the tabs to see exactly how each is handled.
What sample values does the converter use in the generated example JSON?
The sample JSON tab builds a complete example object by filling every field with a representative placeholder so you can see the message shape immediately. A string becomes "example", a double becomes 3.14, integer fields get stand-in numbers, and a bytes field shows a short base64-encoded string like "dGVzdA==" because bytes are typed as base64 strings in JSON. Repeated fields appear as arrays, maps as objects, and nested messages are expanded inline. These are not real data -- they are typed stand-ins meant to seed a fixture, a Postman request body, or a mock API response without typing a realistic payload by hand. Because the values match each field's type, the example will pass against the JSON Schema the tool generates from the same proto. Paste your schema and open the Sample JSON tab to copy or download a ready-to-edit example.
Can I generate TypeScript interfaces directly from a proto3 file?
Yes. Alongside the JSON Schema, the converter produces ready-to-use TypeScript: one interface per message and a real enum per protobuf enum, so the output drops straight into a project and gives you compile-time typing. Field types follow the protobuf JSON mapping -- strings, numbers, booleans, arrays for repeated fields, and ? markers on optional fields. Sixty-four-bit integers are typed as string to avoid precision loss, and bytes fields are typed as base64 strings. Inline comments in your .proto carry through as descriptions, keeping the generated types documented. This keeps a frontend in sync with the backend's source of truth without hand-copying field names every time the schema changes, which is where typos and drift usually creep in. Paste your proto3 definition, switch to the TypeScript tab, then copy the result or download it as types.ts.
Related Tools
Free API Tester Online
Test REST APIs with GET, POST, PUT, DELETE requests. Free, fast, and works entirely in your browser with no sign-up required.
Free cURL to Code Converter
Convert cURL commands to code in JavaScript, Python, PHP. Free, fast, and works entirely in your browser with no sign-up required.
Free JSON Schema Generator
Generate JSON Schema from your JSON data automatically. Free, fast, and works entirely in your browser with no sign-up required.
Free HTTP Headers Parser
Parse and analyze HTTP headers from requests and responses. Free, fast, and works entirely in your browser with no sign-up required.
About the Protobuf to JSON Schema converter
The Protobuf to JSON Schema converter turns a proto3 .proto definition into three artifacts at once: a JSON Schema, a set of TypeScript interfaces, and a sample JSON document filled with placeholder values. Paste your schema into the input box and the tool parses it instantly, showing a quick count of how many messages, enums, and fields it found before rendering each output in its own tab.
It is built for backend and full-stack developers who work with Protocol Buffers and gRPC but need to cross into the JSON world — validating API payloads, generating client-side types, or sharing a contract with a team that does not use protoc. If you just want to see what a message looks like as JSON without setting up the protobuf toolchain locally, this does the job in the browser. There is no sign-up, nothing to install, and your .proto text never leaves your device — the parsing and code generation run entirely client-side in JavaScript.
What the converter understands
The parser targets proto3 and handles the constructs you actually find in real schemas:
- Messages and fields, including the full set of scalar types (
string,bool,bytes, the integer family,double, andfloat). - Enums, both top-level and nested inside a message.
- Nested messages to any depth, with names flattened into dotted definitions like
Order.Address. repeatedfields, mapped to arrays.optionalfields, which become non-required in the schema and optional (?) in TypeScript.map<key, value>fields, rendered as objects withadditionalProperties.oneofblocks, where each member is emitted and the JSON Schema records the mutually exclusive options.
The package declaration and inline comments are picked up too, with comments carried through as description fields and JSDoc annotations.
The three outputs and how they map types
Each tab can be copied to the clipboard or downloaded as a file (schema.json, types.ts, or sample.json):
- JSON Schema follows Draft-07. Nested and referenced message types use
$refpointers into a shareddefinitionsblock, and the root$refpoints at your first message so the schema is ready to drop into a validator. - TypeScript interfaces give you one
interfaceper message and a realenumper enum, so you can paste the result straight into a project and get compile-time typing. - Sample JSON produces an example object with stand-in values (for instance, a
stringbecomes"example", adoublebecomes3.14), which is handy for seeding a fixture, a Postman request, or an API mock.
One detail worth knowing: 64-bit integers (int64, uint64, sint64, fixed64, sfixed64) are represented as strings, not numbers. That is not a quirk of this tool — it is the official Protobuf JSON mapping, because a 64-bit integer can exceed the range JavaScript's number type can safely represent. 32-bit integers stay as numbers, and bytes fields are typed as base64-encoded strings.
Why convert protobuf to JSON at all
Protocol Buffers are compact and fast on the wire, but JSON is still the lingua franca of web APIs, config files, and documentation. Generating a JSON Schema from your .proto lets you validate incoming or outgoing JSON against the same contract your services already enforce in binary form. The TypeScript output keeps a frontend in sync with the backend's source of truth without hand-copying field names. And a ready-made sample payload saves the tedium of typing out a realistic example by hand.
To get started, click Sample .proto to load a worked example with messages, an enum, nested types, a oneof, and a map, then switch between the tabs to see how each construct is translated. Replace it with your own schema whenever you are ready.