I call an HTTP request which returns a protobuf response. I don't have the .pb files, so I try to convert that to a readable format such as JSON with indexed fields.
Using protoc
and the command protoc --decode-raw < test.bin
The output looks like this:
2: 1623325235623240
4: "\037\213\010\000\000\000\000\000\000\000\265[\tTS\327\272\346\204\220J\324g\232Zz\264\n\251\366\366\272\332K\r\220 \364\3425\377Y\335\272\223\253\200#\333\256\304=VKu\036\254%G\3501k\371^\273ZQ\225fg\030e\342\322"\271\207=\222|\366d/\307\25"
5: 1
7: 1
9 {
2: "MethodUpdate"
3 {
1: "ASfeyGDdgsSDgddSDheyWw"
2: 0
}
4: 11
}
I know that everything is meta data on the file and the actual content is in the field 4
. From my knowledge, this is also a protobuf message that should have a similar output. If I copy paste the content of the field 4
and run the protoc
command again, I get the error Failed to parse input.
Is there any way to parse the protobuf response to a readable format such as JSON?
I found similar questions, but non of the suggested answers worked in my case.