-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Description
Bug: The man page does not state what format is used by the --decode and --encode options
Feature request: Add an option to decode directly to json.
Looking for a way to decode a message into json from the command line I stumbled upon:
which mentions the --decode option which at first sight appears to be just what I was looking for.
However the output format is not in fact json but something called "text format" which is undocumented (see #3755).
My use case is that I am writing test cases to check the output of programs that send messages encoded using protocol buffers. I want to convert them to some format that can be analysed easily and add test assertions.
E.g.
ACTUAL=
protoc --decode .... | jq .getSomeField
assertEqual "expected foo" "foo" "$ACTUAL"