How to Convert Protobuf to JSON (Without Installing Anything)

You have a .pb file coming off a gRPC service or a packet capture from a mobile app, and you need to see what is actually in it. The classic route is protoc with the exact .proto schema, the right version of the protobuf runtime, and a bit of luck that the schema on disk matches the one the sender used. In practice that chain breaks at every link: schemas rot, the version the phone is running is not the one you have, and sometimes the other side never gives you a schema at all.

What a protobuf binary really is, underneath all the ceremony, is a flat stream of field numbers and wire types. A varint here, a length-delimited blob there. That means two different jobs. If you have the .proto, decoding is deterministic and fast: each byte lands on the field the schema names for it. If you do not, you can still read the wire structure field by field and get the shape of the message, which is usually enough to reverse-engineer what someone is sending you.

Both jobs are what the tool at proto.datajutsu.com does, in the browser. Paste or drop a .proto and your binary and get JSON back, with nested messages, enums, packages and the google/protobuf well-known types all handled. No schema? The raw decode tab walks the wire bytes and shows every field number, wire type and best-effort value, and recurses into nested messages when one is hiding inside.

The part that saves me is the other direction: JSON to binary. When you are reproducing a request to a service, you write the payload as JSON (which is what you actually think in) and the tool encodes it to the exact wire bytes. The JSON to .proto tab goes further: paste a few sample records with no schema at all, and it drafts the .proto from the data, then proves the draft is right. It encodes your original sample with the drafted schema, decodes it back, and diffs field for field. Green means the schema carries the data. That is a proof, not a guess.

A few wire-format facts that catch people out, all of which the tool calls out instead of silently misbehaving. Sixty-four-bit integers come out as strings in the JSON, per the official protobuf JSON mapping, because JavaScript numbers lose precision past 2 to the 53. Empty repeated fields emit zero bytes, so a list you never populated simply does not exist after a round trip. And snake_case in the .proto becomes camelCase in the JSON unless you ask otherwise. The generated TypeScript, Python, Go and Rust clients, and the JSON Schema output, all follow the same official mapping, so what you generate matches what your server will actually hand you.

Everything runs locally in your browser. Your schema and your payload are never uploaded anywhere, which matters when the payload is the invoice amounts or the session tokens. It is free, no account, and the share link puts your inputs in the URL so you can hand a colleague the exact same case.

Subscribe to Data Jutsu

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe