upvote
The buf CLI can do this.

Here's how it looks to convert from encoded protobuf to json (protojson).

  buf convert schema.proto \
    --type YourMessageName \
    --from payload.binpb \
    --to output.json
And just invert the arguments to convert back.

  buf convert schema.proto \
    --type YourMessageName \
    --from data.json \
    --to encoded.binpb
reply
There is the --encode (and --decode) options for the `protoc` executable, e.g. `cat myobject.json | protoc --encode MyObject protofile.proto > myobject.bin`
reply
[dead]
reply