Skip to content
XUtilHub

JSON to Protobuf (.proto) Schema Generator

Generate a Protocol Buffers .proto schema from JSON. Infers message types, repeated fields and nested messages.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded
Input
Output

About the JSON to Protobuf

Generate a proto3 schema from a JSON sample. Nested objects become messages, arrays become repeated fields, and scalar types are inferred.

Key features

  • Generates a proto3 .proto schema from a JSON sample
  • Nested objects become nested message types
  • Arrays become repeated fields
  • Infers string, int64, double and bool
  • snake_case field names per the Protobuf style guide
  • Sequential field numbers ready for review

From JSON to Protocol Buffers

Protocol Buffers (Protobuf) is Google's compact, typed serialization format, used by gRPC, many microservice architectures, Kafka pipelines and mobile apps. Moving from JSON APIs to Protobuf starts with a .proto schema, and writing one by hand for a large payload is tedious. Paste a representative JSON sample and get a proto3 schema to refine.

Example

{
  "id": 1024,
  "name": "Ada Lovelace",
  "active": true,
  "roles": ["admin", "editor"],
  "address": { "street": "12 Analytical Way", "city": "London" }
}
syntax = "proto3";

message Root {
  int64 id = 1;
  string name = 2;
  bool active = 3;
  repeated string roles = 4;
  Address address = 5;
}

message Address {
  string street = 1;
  string city = 2;
}

Type mapping

JSONProtobuf
stringstring
whole numberint64
decimaldouble
booleanbool
arrayrepeated T
objectnested message
nullstring (refine manually)

Checklist before using the schema

  1. Pick precise integer types: int32, uint32, sint64, etc.
  2. Use well-known types: google.protobuf.Timestamp for dates, google.protobuf.Struct for free-form data.
  3. Add enums for fields with a fixed set of string values (e.g. status).
  4. Review field numbers. Numbers 1–15 take one byte on the wire; give them to the most frequent fields.
  5. Add a package and options such as go_package or java_package.

Generating code from the schema

protoc --python_out=. --java_out=. schema.proto

or use buf generate with a buf.gen.yaml.

Generate Java classes directly with JSON to Java. Inspect the sample's types with JSON Deserialize.

How to use the JSON to Protobuf

  1. Paste your data into the input box, upload a file, or click Sample to try it out.
  2. Adjust the options above the editor if you need to (indentation, delimiter, and so on).
  3. The Protobuf appears instantly in the output panel. Any errors are shown with their line and column.
  4. Click Copy to copy the result, or Download to save it as a file.

Frequently asked questions

Is the generated schema production-ready?

It's a strong starting point. Review the types (e.g. int32 vs int64), field numbers and names, and consider using well-known types like google.protobuf.Timestamp for dates before publishing it.

Why are all whole numbers int64?

A single JSON sample can't show the full range of a field, so int64 is the safe default. Narrow it to int32 or uint32 where you know the limits.

How are null values handled?

A null in the sample becomes a string field, since the real type is unknown. Provide a sample with real values for accurate types.

Can field numbers be changed later?

Before the schema is used in production, yes. Afterwards, never reuse or change a field number: it breaks wire compatibility. Use reserved for removed fields.

Is my JSON uploaded to a server?

No. All JSON tools run entirely in your browser, so your data never leaves your device.

Is there a size limit?

There is no fixed limit. Files of several megabytes work fine; very large files depend on your device's memory.

Do I need an account?

No. Every JSON tool is free and works without signing up.

Last updated:

Related JSON tools