Yes, use the TextFormat class to do this from code, or use protoc's --encode
or --decode option to do it from the command line.  For example:
protoc myproto.proto --decode=MyMessageType < encoded_data >

Replace --decode with --encode to convert back from text to binary.  You can
also use --decode_raw when you don't have the .proto file defining the type
-- in this case you will only get numeric tags but it may still be useful
for debugging.

On Tue, Nov 18, 2008 at 3:40 PM, <[EMAIL PROTECTED]> wrote:

> I've been reviewing the many benefits of Protocol Buffers and I had a
> quick question:
> Is there a  way to pretty-print import/export the contents of a
> protocol buffer?  One of the big advantages of XML is that it's human-
> readable and writable.  It would be great if I could do the same thing
> with Protocol Buffer.
> A typical use-case would be to pretty-print the contents of a Protocol
> Buffer to a file, open up the file in an editor, modify the contents,
> then reload the file back into an application.
> What I'm describing here is easy to do with XML, since it's a very
> human/editor accessible format.  Is there a way to accomplish the same
> sort of thing using Protocol Buffers?
> Thanks!
> -Michael
> >

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to