📦 JSON to Protobuf Schema

Input JSON Data

Options

Generated .proto File

What is the JSON to Protobuf Schema Converter?

Automatically convert JSON data to Protobuf Schema (.proto file) definitions. The tool analyzes JSON structure, infers field types, and generates proper message definitions supporting nested objects, arrays, and enums — a great helper for gRPC and microservice development.

Core Features

Auto Type Inference: Maps JSON value types to Protobuf types automatically

Nested Object Support: Generates nested message definitions

Array Handling: Identifies arrays as repeated fields

proto2/proto3 Toggle: Supports both syntax versions

One-click Download: Download directly as a .proto file

How to Use

Step 1: Paste your JSON data in the input area. Must be valid JSON format — object or array.

Step 2: Set the Message name (e.g., UserRequest), Proto syntax version, and package name. Package is optional.

Step 3: Click "Generate .proto" — the result appears instantly. Copy or download the .proto file for use with the protoc compiler.

Use Cases

gRPC Service Development: When migrating from JSON APIs to gRPC, quickly generate a .proto skeleton, then fine-tune manually — saving significant Schema writing effort.

Microservice Interface Definition: Teams often discuss interfaces using JSON examples. After agreement, use this tool to convert to Protobuf definitions, ensuring implementation matches design.

Data Migration: When migrating JSON configs or data to Protobuf storage, quickly generate corresponding Schema definitions.

Extended Knowledge

Type Mapping: string→string, integer→int32 (int64 if out of range), float→double, boolean→bool, null→NullValue, object→nested message, array→repeated. In proto3, all fields are optional by default.

Protobuf vs JSON: Protobuf serialization is 3-10x smaller than JSON and 20-100x faster to parse, with strict type checking. The downside is it's not human-readable and requires .proto files to parse. Best for internal service communication, not frontend-facing APIs.

What is Protobuf?

Protocol Buffers (Protobuf) is a serialization format developed by Google, smaller and faster than JSON. It requires .proto files to define data structures, and the compiler generates code for various languages. Widely used in gRPC and microservice communication.

How are JSON field types inferred?

The tool auto-infers: string→string, integer→int32 (int64 if out of range), float→double, boolean→bool, null→NullValue, object→nested message, array→repeated.

Does it support nested objects?

Yes. Nested objects automatically generate nested message definitions. For example, a user object in JSON generates a nested message User inside the parent message. Supports any depth of nesting.

Can the generated .proto file be used directly?

The generated .proto file is valid and works with the protoc compiler. We recommend reviewing field numbers and types, and adjusting the syntax version and package name as needed.

How are array element types determined?

The tool uses the first element's type as the repeated field type. If the array is empty, it defaults to string. We recommend checking array field types after conversion.

How are null values handled?

JSON null values are inferred as NullValue type. You can also use the optional keyword for fields that may be null (proto3 syntax).

JSON to Protobuf Schema | No Signup, Client-Side · No Server Uploads

Feedback: dexshuang@google.com