Protobuf to JSON Converter - Decode Protocol Buffer Messages to JSON
Read Protobuf text format, base64 or hex binary messages and .proto files as JSON, with 64-bit values kept exactly.
How to Convert Protobuf to JSON - Step by Step Guide
Paste Your Protobuf Message
The page reads Protobuf text format, binary messages and .proto files, and tells them apart on its own:
protoc --decode, a message's DebugString(), or a .textproto file from your gRPC project.Example: text format input
id: 123
name: "Michael Rodriguez"
email: "michael@example.com"
roles: ["admin", "user"]
active: true
profile {
department: "Engineering"
experience_years: 5
}Read the JSON
The JSON shows up a moment after you stop typing:
experience_years stays experience_years.[a, b] list, becomes a JSON array. Nested messages become nested objects.Example: the Step 1 input as JSON
{
"id": 123,
"name": "Michael Rodriguez",
"email": "michael@example.com",
"roles": [
"admin",
"user"
],
"active": true,
"profile": {
"department": "Engineering",
"experience_years": 5
}
}Copy or Download
Copy puts the JSON on your clipboard and Download saves it as converted.json, exactly as shown. For a binary message without a schema, the result lists each field by number:
Example: base64 binary CHsSA0FkYQ==
[
{
"field": 1,
"wire type": "varint",
"value": "123",
"other readings": "sint64: -62"
},
{
"field": 2,
"wire type": "string",
"value": "Ada"
}
]Going the other way? JSON to Protobuf builds a .proto schema and binary from JSON, and Protobuf to Table shows the same input as a table.
Frequently Asked Questions
What kinds of Protobuf input can I paste?
Three kinds, and the page works out which one you gave it. Protobuf text format, the name: "value" layout that protoc --decode, DebugString() and .textproto files use, including nested messages, repeated fields and [a, b] lists. A binary message written as base64 or hex, or a .pb/.bin file you upload. And a .proto schema, which comes out as a list of its messages, fields, enums and services rather than as data. The Text Format / Base64 Binary menu only decides which sample gets loaded.
Can I decode binary Protobuf without the .proto file?
Yes, the same way protoc --decode_raw does. The wire format stores field numbers and wire types but not field names, so a binary message comes out as a list of rows: the field number, how it was encoded (varint, string, nested message, fixed32 and so on) and the value. Where the bytes could mean more than one thing, for example a varint that might be a signed sint64, the other readings are listed next to it. With the schema at hand you can match field numbers to names yourself.
Why are some numbers in quotes in the JSON?
So that no digit is lost. A JavaScript number holds about 15 to 16 digits, so an int64 such as 8901240544102066246 or -9223372036854775808 would quietly turn into 8901240544102066000 if it were written as a bare JSON number. Those values are written as strings instead, which is also how the official proto3 JSON mapping writes int64 and uint64. Decimals stay numbers and keep the spelling you typed, so 14.50 comes out as 14.50, not 14.5, and ordinary numbers such as 42 stay plain numbers.
Why does my text format give an error?
The error names the line and column where reading stopped. Common causes are a string missing its closing quote, a field name written in quotes ("name": "x" is JSON, not text format), text values without quotes, or a brace that is never closed. If you pasted JSON by mistake, the page says so and points you to a JSON tool instead.
How do I get text format out of my own service?
If you have the .proto file, protoc --decode=your.package.Message your.proto < message.bin prints text format you can paste here. Most Protobuf libraries can also print a message that way, for example DebugString() in C++ or str(message) in Python. For a raw gRPC payload with no schema, base64-encode the bytes and paste them, and the page decodes the wire format directly.
Is my data uploaded anywhere?
No. Reading the text format, decoding the binary and parsing a .proto file all happen in your browser, and nothing you paste or upload is sent to our server. A reload starts with an empty editor.
Related Tools
Protobuf to Table
Convert Protocol Buffer text format data to HTML table format
Protobuf Fixer
Fix broken .proto schemas automatically, repair syntax errors, and validate Protobuf structure
JSON to Protobuf
Convert JSON data to Protocol Buffer format
Protobuf to TypeScript
Generate TypeScript interfaces and types from Protocol Buffer schemas
TypeScript to Protobuf
Generate Protocol Buffer schemas from TypeScript interfaces
Protobuf to Java
Generate Java classes and POJOs from Protocol Buffer schemas