Protobuf to JSON: Every Real Conversion Error and How to Fix It
When protobuf and JSON do not agree, the error is almost always one of a handful of specific things, and each one has a fix that takes minutes once you know the shape. Here are the real ones, in roughly the order they bite people. None of them are your data being corrupt. All of them are the format working exactly as designed.
First and most common: 'unknown field number' (or, in some languages, a parse failure on an unexpected tag). This means your .proto does not declare a field that the binary contains, or the numbers do not line up. The data is not lost. A field number like 35 sits on the wire in plain view even with no schema, so the move is to decode the bytes with no schema at all, read the field numbers and their types, then map them to the keys you expect in your JSON and number the fields accordingly. That is also how you reverse-engineer a .proto when nobody hands you one: the raw-decode tab shows every field number, wire type, and best-effort value from the raw bytes, and the infer tab drafts the .proto from your JSON and the verify round trip proves it carries the data.
Second: 'expected number, got string', or a 64-bit ID that came back mangled. The official protobuf JSON mapping encodes int64 and uint64 values as decimal STRINGS, because 64-bit integers do not survive JavaScript numbers above 2 to the 53rd power. So {"order_id":"1099710850764"} is the correct JSON for that ID, and a parser that only accepts numbers rejects correct data. If your side needs numbers instead, the encoders have a flag for it (printLongsAsNumbers in Java, for example). The schema is identical either way; only the representation changes.
Third: a field that silently comes back empty, or an error about an unknown key, after you change nothing but the casing. Protobuf field names are snake_case in the .proto (user_id, created_at) but the official JSON mapping defaults to camelCase (userId, createdAt). Most languages accept both on the way in, but a strict setup or a hand-rolled parser will drop user_id fed as userId, and the rest of the message looks fine, which is the worst kind of failure. Normalize the keys in one place and the error disappears.
Fourth: an empty array that comes back missing after a round trip, and people report it as a bug. An empty repeated field encodes to zero bytes. On the wire it simply is not there, so when you decode, the field is absent rather than an empty list. Same message bytes with no tags field at all. That is the format working, not your data, and it shows up in every diff of a round trip as a dropped empty array. Fifth, if you are getting a type error on a nested block, your .proto declares that field as a scalar (string, int64) when the value is a whole message: a length-delimited field that does not parse as a string is a sub-message, declare it as one.
The workflow that keeps you out of all of it is short. Unknown field number, raw-decode the bytes first and map numbers before touching the schema. Then draft or edit the .proto, and before you ship it, run the data back through it: proto.datajutsu.com does the whole loop in the browser, infer the schema from your JSON, verify it with a round trip that names the exact field on any real mismatch, decode and encode either direction, and explain what any field actually means. Nothing you paste leaves the page.
If you are new to the format, start with what protobuf is and how the wire format works. And for the conversion directions covered in detail: protobuf to JSON with the schema, JSON to binary, generating a .proto from JSON, and reading a .pb file with no schema.