JSON Schema to Protobuf Converter
Convert JSON Schema to proto3 message definitions — types, nested messages, enums, repeated fields
Options
993 characters
3 messages + 1 enum generated · 531 characters
You have a JSON Schema defining your data model, and now you need Protocol Buffer definitions for gRPC services or efficient binary serialization. Manually translating JSON Schema types to proto3 message fields — mapping strings, numbers, booleans, nested objects, and arrays to their protobuf equivalents — is tedious and error-prone.
What Are Protocol Buffers?
Protocol Buffers (protobuf) is Google’s language-neutral, platform-neutral serialization format. Unlike JSON, protobuf uses a binary wire format that is smaller and faster to parse. Proto definitions (.proto files) describe message structures that are compiled into code for Go, Java, Python, C++, TypeScript, and other languages. Protobuf is the standard serialization format for gRPC.
How This Converter Works
Paste a valid JSON Schema and the tool generates proto3 message definitions:
- Primitive type mapping:
string→string,number→double,integer→int32,boolean→bool - Objects:
type: "object"withpropertiesbecomes amessagewith numbered fields - Arrays:
type: "array"withitemsbecomesrepeatedfields - Nested objects: Inline object schemas become nested message definitions
- Enums:
enumarrays of strings become protoenumtypes - Optional fields: Properties not in
requireduse theoptionalkeyword (proto3) - $ref resolution: Internal references are resolved and generate separate named messages
Common Use Cases
REST to gRPC migration — Convert your existing JSON Schema API contracts to protobuf definitions when migrating from REST/JSON to gRPC.
Polyglot services — Generate proto definitions from your JSON Schema, then compile to Go, Java, Python, or TypeScript for consistent data structures across microservices.
Performance optimization — Replace JSON serialization with protobuf for internal service communication where payload size and parsing speed matter.
Schema evolution — Use protobuf’s built-in backward compatibility (field numbers) alongside your existing JSON Schema versioning strategy.
Proto3 Type Mapping Reference
| JSON Schema | Proto3 Type |
|---|---|
string | string |
number | double |
integer | int32 |
boolean | bool |
object | message |
array | repeated |
null | google.protobuf.NullValue |
Frequently Asked Questions
Q: Which protobuf syntax version is generated?
A: The tool generates proto3 syntax, which is the current and recommended version. Proto3 has simpler semantics — all fields are optional by default, and the optional keyword explicitly marks presence tracking.
Q: How are nested JSON Schema objects handled?
A: Each nested object becomes a nested message definition inside the parent message. Deeply nested structures produce correspondingly nested messages.
Q: What happens to JSON Schema $ref references?
A: Internal $ref references are resolved and generate top-level message definitions. The referencing field uses the message name as its type.
Q: Are field numbers assigned automatically? A: Yes. Fields are numbered sequentially starting from 1 in declaration order. After generating, you should review and stabilize field numbers before using them in production, since changing numbers breaks backward compatibility.
Q: Is my schema sent to a server? A: No. All conversion runs in your browser using JavaScript. Your JSON Schema never leaves your device.