On Tuesday, December 29, 2009 7:04:21 AM UTC+1, Pavel Shramov wrote: > > On Tue, Dec 29, 2009 at 10:34:17AM +0800, 龟腚 wrote: > > hi, i am a protobuf user also python user > > and i want to translate protobuf object to python Dict object (or call it > > hash?) > > its because i was developing a web gate witch query data from intranet's > ice > > server and got the data in protobuf type > > then i translate it to Dict object and return it to internet user as in > json > > format. > > any advice or suggestion is welcom > I've created JSON serialilzation/deserialization routines for PB messages > in > my RPC project [1]. Usage is simple -- import file [2] and if one of JSON > implementations (simplejson or cjson) are available You'll be able to call > SerializeToJSON and ParseFromJSON methods. > > Pavel > > -- > [1] http://grid.pp.ru/wiki/pbufrpc#_json_wire_format > [2] http://grid.pp.ru/cgit/psha/pbufrpc/tree/pbufrpc/json.py >
Seems like the links are broken. Anyhow I wrote a small python converter from json/dict to protobuf and vice versa. https://github.com/NextTuesday/py-pb-converters It should cover even repeated fields. Only requirment is that one needs the classes generated by protobuf on the .proto files... Hope its useful, and feel free to report issues. Cheers Seif -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
