JSON to Protobuf
Online JSON to Protobuf converter with Proto2/Proto3 syntax and field type mapping to generate ready-to-use .proto message definitions
Protobuf Settings
Protocol Version
Generation Options
Type Mapping
Configure JSON type to Protobuf field type conversion rules
JSON Input
Protobuf Definition
PROTO3 Definition
Waiting for generated Protobuf definition...
Conversion Stats
0
Messages
0
Fields
0
Enums
0
Nested Messages
JSON to Protobuf Guide
This tool converts JSON objects into .proto definitions with Proto2 and Proto3 support, helping with gRPC API modeling, contract drafting, and integration preparation.
Proto2 vs Proto3
- Proto2 supports required/optional/repeated and is suitable for stricter legacy contracts.
- Proto3 simplifies syntax and aligns better with modern gRPC-based services.
- Proto3 optional can be enabled to represent field presence when needed.
Conversion Rules
- JSON objects are mapped to message blocks, and field names are converted to snake_case.
- JSON arrays are mapped to repeated fields, and object items generate dedicated message types.
- Integer, float, boolean, and string mappings follow your selected type strategy.
- Null values fall back to string mapping to keep generated schemas compilable.
How to Use
- Select Proto2 or Proto3, then set package name and message prefix.
- Adjust generation options and type mappings based on your protocol requirements.
- Paste JSON or load a sample, and the .proto output is generated automatically.
- Review the result and copy or download the generated .proto file.
Best Practices
- Map very large integers to string or int64 to avoid precision issues.
- Use a consistent strategy for date fields, such as ISO string or int64 timestamp.
- If array items have inconsistent shapes, normalize sample data before conversion.
- All conversion runs locally in the browser and does not upload your data.
FAQ
- Why does an array type look incorrect? The converter infers from effective sample items in the array.
- Why was my message name changed? Invalid characters are normalized to keep .proto syntax valid.
- Why is enum not generated? This tool focuses on structural message generation; enums can be added manually.