Protobuf text to JSON converter
Paste a message in the Protocol Buffers text format, from a .txtpb file, a log or a debug print such as Go's String() or Java's toString(), and see it as JSON below, as you type.
Fields, lists and values
Each message becomes an object and each field a key. A field written more than once, or as a list ([a, b]), becomes a JSON list. Strings are decoded, escapes and octal UTF-8 bytes included; enum values keep their names; 64-bit integers keep every digit.
Struct, maps and Any, as protobuf's JSON writes them
A google.protobuf.Struct, Value or ListValue becomes the JSON it holds: fields { key: "name" value { string_value: "demo" } } is simply "name": "demo", in the compact form Go prints too. A map field becomes an object of its keys, and an expanded Any its message with "@type". Anything without that exact shape converts as written.
Without the .proto
The text is read on its own, with no schema. So a repeated field written only once stays a single value, field names stay as written (user_id, where protobuf's own JSON writes userId), and bytes that aren't text come out in Base64. Fields written by number (5: …) keep their numbers as keys.
YAML, XML, a schema
The same message converts to JSON5, YAML, TOML, XML or CSV from Convert to above the editor, or into a JSON Schema that describes it. To check a message against a schema you already have, test it in the JSON Schema validator.
Copy, download or keep editing
The JSON follows your typing, and a mistake in what you paste is pointed out first, with its line and column. Copy or Download take the JSON as it is; Use as text puts it in the editor in place of what you pasted (Ctrl+Z goes back).
Private: nothing is uploaded
Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.
With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.
Questions
Can it convert binary protobuf?
No: it reads the text format. A binary message needs its .proto to be decoded: protoc --decode prints it as text, which can be pasted here (protoc --decode_raw works too, with field numbers for names).
Why is my repeated field not a list?
It was written once. The text format writes a repeated field once per item, so a single item looks just like a single field, and without the .proto there is no telling them apart.
What happens to inf and nan?
JSON has no such numbers, so they become "Infinity", "-Infinity" and "NaN", as protobuf's own JSON writes them. JSON5 and YAML keep them as numbers.
Is my data uploaded anywhere?
Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.
More tools
- Formatter & Converter for JSON, YAML, XML, SQL
- Protobuf Text Format (textproto) Formatter
- Protobuf Text Diff – Compare textproto Messages
- JSON to YAML Converter
- YAML to JSON Converter
- JSON to TOML Converter
- TOML to JSON Converter
- CSV to JSON Converter
- JSON to CSV Converter
- Free Online Diagram Maker & Editor
- Crypto Tools: Passwords, Keys, Hashes & JWTs
- Timestamp, Cron, Regex & UUID Utilities