JSON conversion utility function is expected to be compatible with proto-lite library?
On Wednesday, May 13, 2015 at 12:26:16 AM UTC+5:30, Feng Xiao wrote: > > On Tue, May 12, 2015 at 9:56 AM, Mikhail Melnik <[email protected] > <javascript:>> wrote: > >> There is mention in official documentation >> https://developers.google.com/protocol-buffers/docs/proto3#json >> that says JSON encoding/decoding is supported by prtotobuf. >> >> But in release notes https://github.com/google/protobuf/releases it is >> said >> that json encoding should be implemented in 3 version of protocol. >> Also there is no json encoder/formatter in source code. >> >> So it's not clear for me is it implemented or not? >> > It's not implemented yet. > > >> In case it's not, will it be implemented in the future? >> > Yes. > > >> >> If this functionality already exists does any one can provide example how >> to make such conversion? >> I'm especially interesting in Java implementation of protobuf -> json >> conversion and vice verse. >> > We will provide an utility class that converts between protobuf binary > format and JSON. The API will look like this: > class JsonFormat { > void convertBinaryToJson(TypeResolver typeResolver, InputStream > binaryInput, Writer jsonOutput); > } > interface TypeResolver { > com.google.protobuf.Type resolveMessageType(String typeUrl); > com.google.protobuf.Enum resolveEnumType(String typeUrl); > } > > The JSON output will follow the spec described in the proto3 developer > guide. > > > >> >> If any one has information on topic I would be very grateful. >> >> >> On Friday, April 1, 2011 at 11:32:42 PM UTC+3, Austin Ziegler wrote: >>> >>> On Fri, Apr 1, 2011 at 11:19 AM, Konrad Malawski >>> <[email protected]> wrote: >>> > Sure, just google "protobuf json" -> >>> http://code.google.com/p/protobuf-json/ >>> >>> > 2011/4/1 ZHOU Xiaobo <[email protected]> >>> >> >>> >> script languages can easily dealing with JSON, but >>> >> in C/C++ is actually difficult. >>> >> can protobuf support json encode/decode? >>> >>> A few weeks ago, someone on my team wrote something in Ruby to >>> generate the .proto file that would be associated with the JSON that >>> we're expecting, plus the necessary YAJL code to parse the JSON in >>> C++. >>> >>> It's not that hard to do, but we can't open source our work (it's too >>> raw in any case). >>> >>> -a >>> -- >>> Austin Ziegler • [email protected] • [email protected] >>> http://www.halostatue.ca/ • http://twitter.com/halostatue >>> >>> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/protobuf. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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. For more options, visit https://groups.google.com/d/optout.
