JSON to Protobuf
Paste or drop your data here, or open a file.
New to Bracely?
Everything stays in your browser.
Output appears here
Paste or open your data in the input box. It never leaves your browser.
JSON to Protobuf
Paste a JSON sample, such as an API response, and Bracely writes Protocol Buffers messages for it. Each object becomes a proto3 message with numbered fields, and arrays become repeated fields.
Example: an order event for a gRPC or Kafka pipeline
An order event as JSON, with money in whole paise as payment APIs send it. Each object becomes a proto3 message with numbered fields, whole numbers become int64 and the weights double, the items list becomes a repeated field of its own Item message, and the coupon, missing from one item, is marked optional:
Input
{
"order_id": "ORD-20419",
"customer_id": 7,
"placed_at": "2026-10-29T10:00:00Z",
"total_paise": 409700,
"items": [
{
"sku": "KB-01",
"qty": 1,
"price_paise": 249900,
"weight_kg": 1.2,
"coupon": "DIWALI10"
},
{
"sku": "MS-02",
"qty": 2,
"price_paise": 79900,
"weight_kg": 0.1
}
],
"express": true
}Output
syntax = "proto3";
message OrderPlaced {
string order_id = 1;
int64 customer_id = 2;
string placed_at = 3;
int64 total_paise = 4;
repeated Item items = 5;
bool express = 6;
}
message Item {
string sku = 1;
int64 qty = 2;
int64 price_paise = 3;
double weight_kg = 4;
optional string coupon = 5;
}
How do I use the JSON to Protobuf?
- Paste a JSON sample.
- Set the root type name, for example Order.
- Copy the Protobuf code into your project.
What does the JSON to Protobuf do?
- proto3 syntax with numbered fields
- repeated for arrays
- optional for fields that can be missing
- Nested objects become their own named types
- 20 other languages from the same sample, including TypeScript
When to use the JSON to Protobuf
Moving an API from JSON to gRPC, or putting events on Kafka or Pub/Sub in Protocol Buffers, starts with a .proto file. Writing it from an existing JSON payload gets every field and nesting right, and gives you a schema to compile with protoc or buf for Go, Java, Python, C#, TypeScript and the other languages Protobuf supports.
Each object becomes a proto3 message with fields numbered in order and snake_case names, as the Protobuf style guide asks. Whole numbers become int64, decimals double, true/false bool and lists repeated fields of their own message type. A field missing from some items is marked optional so its presence can be checked, and a field whose values disagree becomes google.protobuf.Value, with its import added.
Frequently asked questions
- Can I change the field numbers?
- Only before the first message is sent. Field numbers are what goes over the wire, so once data exists, never renumber or reuse one; add new fields with new numbers and reserve the numbers of removed ones.
- Should timestamps stay strings?
- JSON sends them as text, so the sample gives string. For a real schema, use google.protobuf.Timestamp (import google/protobuf/timestamp.proto), which every Protobuf library converts to its own date type.
- How does it pick Protobuf types?
- From the values in your sample: whole numbers, decimals, text, true/false, arrays and nested objects. When array items disagree, the field is made optional or widened.
- Can I generate other languages?
- Yes. Change Language to any of the others: TypeScript, Go, Python, Pydantic, Java, C#, Kotlin, Swift, Rust, Scala, Ruby, Dart, PHP, Zod, TypeBox, Valibot, Yup, GraphQL, Prisma and Drizzle.
- Is my data uploaded?
- No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.
More JSON tools
Bracely has 108 JSON tools in one page. Related ones:
- JSON to Pydantic
- JSON to TypeBox
- JSON to Valibot
- JSON to Yup
- JSON to Prisma
- JSON to Drizzle
- JSON to Scala
- JSON to Ruby
- JSON Schema builder
- JSON Schema validator
- JSON data dictionary
- OpenAPI from JSON
- JSON to ER diagram
- JSON Schema to TypeScript
- JSON to MessagePack
- Query string to JSON
- UUID generator
- JSON hash
- TypeScript formatter
- Code screenshot
- JSON Formatter
- JSON Validator
- JSON Viewer
- JSON Repair
- JSON Diff
- JSON to YAML
- JSON to CSV
- jq Playground
Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram