A protobuf debugging tool – protoc --decode_raw
on steroids.
Large binary data is truncated by default. The length is always visible. You can use --full
to show the full data. In combination with the message selection (see below) you can get an overview first and then get the full data of specific fields.
String content is ready to be pasted to things like echo '{"my": "json"}' | jq
.
Use a jq-like syntax to select sub-messages only.
The tool decides between nested protobuf messages, strings and raw bytes on a best-guess basis. Sometimes it is wrong but you can help. E.g. if you know, no fixed length types are used, add --no-fixed
to get the correct output.
cargo install decode_raw
Depending on how cargo is set up on your system you should find the binary in $HOME/.cargo/bin
or $CARGO_HOME/bin
. It is covenient to add this folder to you $PATH
.
You can check your installed version with decode_raw --version
and update with:
cargo install --force decode_raw
decode_raw reads serialized protobuf from STDIN and prints it.
From pipe
$ echo 08bf99bfb4e502120a4a616e6520536d697468 | xxd -r -p | decode_raw
1: 95941545151
2: (10 bytes) 'Jane Smith'
From file
decode_raw < docs/person.bin
1: 1021211
2: (8 bytes) 'John Doe'
3 {
· 1: 959435311
· 2: (11 bytes) 'Susanne Doe'
}
3 {
· 1: 81154811
· 2: (9 bytes) 'Mac Smith'
· 3 {
· · 1: 95941545151
· · 2: (10 bytes) 'Jane Smith'
· }
}
decode_raw should:
protoc --decode_raw
It does not intend to: