I tried to decode a protobuf binary message using protoc and I am getting "Failed to parse input" error. I tried both protoc --decode_raw < proto.bin and protoc --decode package.MessageType MySchema.proto < proto.bin.
I read two threads in SO, one of which suggests that protoc --decode is not 100% reliable and another one which suggests that message length data at the beginning needs to be stripped manually. My question is
- How to use
protoctool for decoding proto binaries? - Is it true that the tool is not 100% reliable to be capable of decoding (even if I supply type) or messages need some hacking before they can be deserialized? (which begs the question, what is the purpose of
protoc --decodeoption?
P.S: I am using protoc 3.6.1 and messages are created in a Java program (syntax=proto2)