Protobuf to JSON Schema

Converts .proto messages and enums into a JSON Schema draft-07 document with definitions, following the proto3 JSON mapping: int64 as numeric strings, bytes as base64 and Timestamp as date-time.

Use the tool

Why this tool exists

Protobuf describes your messages for gRPC, but plenty of tooling around an API expects JSON Schema: validators, form generators, documentation sites, API gateways and mock servers. Rewriting the schema by hand keeps two definitions in step only until the next change. This tool turns the .proto source into a draft-07 schema with definitions for each message and enum, using the same rules protobuf uses for JSON: camelCase property names, 64-bit integers as numeric strings, bytes as base64 and timestamps as date-time. You choose the root message, or let it find the first top-level one. Imports are not followed, so paste related files together. Your file is processed in your browser.

How to use it

  1. Paste the .proto source into the input box.
  2. Name the root message, or leave it blank, and set camelCase and 64-bit integer options.
  3. Copy the JSON Schema and use it with your validator or documentation tool.

Frequently asked questions

Which JSON Schema version does it write?

Draft-07, with a definitions section that holds every message and enum, and $ref links between them. The root message is referenced from the top of the document.

How are int64 values described?

By default as strings holding numbers, matching the proto3 JSON mapping. You can choose number instead if your system uses numeric JSON.

How is the root picked?

By the message name you enter. If blank, it takes the first top-level message that no other message uses.

Does it support proto2 and imports?

It reads proto2 and proto3 syntax in the text you paste. Imported files are not fetched, so include the messages you need.