> ## Content Index
> Fetch the complete content index at: https://datajutsu.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Convert Protobuf to JSON Schema (That Actually Matches the Wire)
- URL: https://datajutsu.com/proto-to-json-schema/
- Published: 2026-10-20T11:44:15.000Z
- Updated: 2026-10-20T11:44:15.000Z
- Author: Data Jutsu

You have a gRPC or protobuf service behind a gateway, and a partner, or a team of your own, wants a JSON schema for it: to validate payloads, generate mock data, feed a form builder. You hand over the .proto. They stare at it. protoc has no official proto to JSON Schema output, and the community generators that do exist are old, half of them get the official JSON mapping wrong, and all of them are a CLI install on a machine that is not theirs.

The trap is that type-mapping is the easy part. A generator that only maps types gets string and int32 right and then quietly gets everything that actually matters wrong. int64 and uint64 can come out of a real service as either a number or a decimal string, per the official protobuf JSON mapping, so the schema has to accept both, not pick one. Unsigned types carry a zero floor. bytes is a base64 string, not a blob. An enum is an integer with a named list of values. A nested message is a reference to another definition, not an inline guess. Timestamp, the wrapper types, maps: each has its own shape. A schema that misses any of these does not fail loudly. It just rejects real data from your own service, and the other side files the bug against you.

The Generate tab at [proto.datajutsu.com](https://proto.datajutsu.com/?ref=datajutsu.com) does exactly this job. Paste a .proto, pick JSON Schema, and you get a draft 2020-12 document that follows the official mapping field by field: 64-bit integers as integer-or-string with the format marked, unsigned types with minimum 0, bytes as base64, enums as integer plus their names, messages as $ref with every user type under $defs, the well-known types inlined properly so a Timestamp becomes a date-time and no google/protobuf stub leaks into the output, maps as objects with typed values, repeated fields as arrays. One message gives you a clean top-level reference; several give you an anyOf across them. It runs in the browser, the schema is never uploaded, and you download a generated.json.

The cases where this actually saves time: a partner who speaks JSON gets a validator that agrees with what the wire does, so you stop being the source of 'your data is invalid' tickets. A team generating fixtures or mock responses gets types that match reality instead of invented ones. And it pairs with the rest of the loop: if you do not have a .proto, the infer tab drafts one from sample JSON and the verify round trip proves it carries the data, and the generated schema then comes off the same draft you already trust.

Hand-writing this schema from memory is how drift starts. The first version looks fine. Then someone hard-codes int64 as integer only. Then the service that legitimately sends a 13-digit order ID as a string fails validation in production, and the fix is a diff between two documents that were supposed to say the same thing. Generating it from the .proto makes the schema a function of the schema file: when the .proto changes, you re-run and re-download, and the difference is reviewable instead of remembered.

The full loop is short, and all of it runs in the browser: read or draft the .proto, generate the JSON Schema off it, verify with a round trip if you drafted it, and hand the other side a document that matches the wire. The same tool covers the other directions too: [protobuf to JSON with the schema](https://datajutsu.com/protobuf-to-json/), [reading a .pb file with no schema at all](https://datajutsu.com/read-pb-file-without-schema/), [JSON to binary](https://datajutsu.com/json-to-protobuf/), [drafting a .proto from JSON](https://datajutsu.com/json-to-protobuf-schema/), and [the errors this whole cluster keeps producing](https://datajutsu.com/protobuf-json-conversion-errors/). If protobuf is new to you, start with [what it is and how the wire format works](https://datajutsu.com/what-is-protobuf/).