Developer Tools
JSON to Protobuf Converter
Convert JSON to a proto3 .proto schema in your browser. Infers messages, scalar types, repeated fields, optional keys, field numbers, and json_name.
Output options
Live preview updates with every change. All inference happens in your browser; the JSON you paste is not uploaded.
Name of the top-level message. Converted to a valid PascalCase proto identifier automatically.
Adds a package declaration under the syntax line, for example package example.v1;.
Integer type
Whole numbers map here. uint64 is used only when no sampled value is negative; otherwise it falls back to int64. sint64 is best for values that are often negative.
Decimal type
Numbers with a fractional part map here. double keeps full JSON number precision; float halves the size with less precision.
Unknown and mixed type
Used for empty arrays, all-null fields, mixed-type arrays, and nested arrays. Value imports google/protobuf/struct.proto.
Indent
The proto style guide uses 2 spaces; pick 4 to match a wider house style.
How to use
- Paste a JSON value into the input on the left, or click Load sample JSON to see a worked example.
- Read the generated proto3 schema on the right; one message is emitted per nested object shape, with the root named after the Root message name field.
- Pick the integer type (int64 is the safe default, sint64 for often-negative values) and the decimal type (double keeps full precision, float halves the size).
- Toggle Mark missing fields optional so keys absent from some array elements use the proto3 optional keyword, and Detect ISO timestamps to map date-time strings to google.protobuf.Timestamp.
- Optionally add a package line, then click Copy proto or Download .proto to use the schema with protoc, buf, or your gRPC toolchain.
About this tool
JSON to Protobuf Converter turns any JSON value into a proto3 .proto schema entirely in your browser. Paste an API response, a config file, a fixture, or a copied object literal, and the tool parses it with the browser's native JSON parser, walks the resulting tree, and emits one message per object shape with a syntax = "proto3" header. Scalar values map to proto3 scalar types: strings to string, booleans to bool, whole numbers to int64 (or int32, uint64, or sint64 depending on the integer strategy you choose), and numbers with a fractional part to double (or float). Field names are converted to lower_snake_case to match the protobuf style guide, while message names are PascalCase, and every field is assigned a sequential field number starting at 1 in declaration order, which is the wire tag protobuf uses to identify fields. Nested objects are promoted into their own named messages referenced by name, so the file reads top-down from the root message and matches the structure of hand-written proto. JSON arrays become repeated fields, with the element type inferred from the union of every element seen, so a list of objects produces a single merged message and a list of numbers produces a repeated scalar. When the original JSON key cannot be expressed verbatim as a snake_case identifier, the tool appends a [json_name = "originalKey"] field option so the generated message round-trips the exact JSON your service already returns. Because proto3 has no top-level non-message values, a JSON document whose root is an array or a scalar is wrapped in a single-field message so the output stays valid. There are options for the integer type (uint64 is only used when no sampled value is negative, otherwise it falls back to int64), the decimal type, the placeholder type for empty arrays and mixed unions (a plain string or google.protobuf.Value from struct.proto), whether keys that are missing from some array elements get the proto3 optional keyword, the indent width, and an optional package declaration. ISO 8601 date-time strings can be detected and typed as google.protobuf.Timestamp with the import added automatically. The result is ready to copy or download as a .proto file you can feed to protoc, buf, or any gRPC toolchain. Parsing, type inference, and code generation all run locally on your device, so the JSON you paste here is never uploaded.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
JSON to Go Struct Converter
Generate idiomatic Go structs with json tags from any JSON value.
Open tool
DeveloperJSON to Rust Struct Converter
Paste JSON, get idiomatic Rust structs with serde derives and Option<T> fields.
Open tool
DeveloperJSON to TypeScript Converter
Generate TypeScript interfaces or types from any JSON value with full inference.
Open tool
DeveloperJSON to GraphQL Schema Generator
Infer a GraphQL SDL schema from JSON with smart scalar, ID, and nullability detection.
Open tool
DeveloperJSON Formatter
Format, minify, and validate JSON in your browser.
Open tool
DeveloperJSON Schema Generator
Infer a JSON Schema document (Draft 7 or 2020-12) from any JSON value.
Open tool