Thanks. I downloaded the binaries and tried to use the test class but my compiler couldn't see class protobuf.codec.json.TypesProtoBuf, it's not anywhere in the binaries. Has this class been added recently but was not reflected to the binaries? I also tried to download source, but seems like GIT is very tedious to configure.
On Jan 3, 8:47 pm, Siju Varghese <[email protected]> wrote: > You could usehttps://github.com/sijuv/protobuf-codec. You can check the > test case > athttps://github.com/sijuv/protobuf-codec/blob/master/protobuf-codec-js... > usage. This library is listed under the google protobuf > ThirdPartyAddOns > wiki as "Another JSON encoder/decoder for > Java<https://github.com/sijuv/protobuf-codec>". > > Let me know if you run into any issues. > > Regards. > > On Wed, Dec 29, 2010 at 4:34 AM, Kenton Varda <[email protected]> wrote: > > You should probably contact the authors of protobuf-java-format; I'm not > > sure if they pay attention to this list. > > > Base64 is the best way to encode arbitrary (non-text) data as text. > > However, it's really up to the JSON converter code you are using to decide > > what format to use. As far as I know, JSON does not specify any particular > > encoding for arbitrary bytes. > > > On Sat, Dec 25, 2010 at 2:40 AM, yalmasri <[email protected]> wrote: > > >> Thanks for the reply. > > >> I encoded "Hello world" in Base64 and I got this "SGVsbG8gd29ybGQ=". > >> That doesn't look close to the format I sent in the question. Here's > >> the code snippet I used: > > >> import org.apache.commons.codec.binary.Base64; > >> public class Codec { > >> public static void main(String[] args) { > >> try { > >> String clearText = "Hello world"; > >> // Base64 > >> System.out.println("Encoded: " + > >> Base64.encodeBase64String(clearText.getBytes())); > >> } catch (Exception e) { > >> e.printStackTrace(); > >> } > >> } > >> } > > >> I'm using this:http://code.google.com/p/protobuf-java-format/for > >> JSON <--> PB conversion > > >> On Dec 23, 3:48 am, Kenton Varda <[email protected]> wrote: > >> > You will probably need to base64-encode bytes fields before embedding > >> them > >> > in JSON, since JSON is a text format. > > >> > Which JSON <-> protobuf converter are you using? Or did you write your > >> own? > > >> > On Tue, Dec 21, 2010 at 11:41 PM, yalmasri <[email protected]> wrote: > >> > > Hello, > > >> > > One of our customers is still using legacy Java 1.4 and therefore > >> > > could not use PB. For that we created an intermediate service that > >> > > receives text messages in plain JSON format then convert them into > >> > > generated PB objects. > > >> > > In one object we have a field named "desc" of type "bytes" which will > >> > > hold a textual description of the arriving message. When the customer > >> > > wants to send English text for "desc" the value in JSON will be plain > >> > > readable English, but if non-ASCII is to be used, how the value in > >> > > JSON will look like? It look to me something like: > > >> > > \0069\0062\006J\0062\006J\000 \006\'\006D\0069\006E\006J\006D\006\f > >> > > \000 \006D\006B\006/\000 \006\'\006F\006*\006G\006I\000 > > >> > > But I really don't know how to get this out of non-ASCII characters. > > >> > > Can anyone help? > > >> > > -- > >> > > You received this message because you are subscribed to the Google > >> Groups > >> > > "Protocol Buffers" group. > >> > > To post to this group, send email to [email protected]. > >> > > To unsubscribe from this group, send email to > >> > > [email protected]<protobuf%[email protected]> > >> <protobuf%[email protected]<protobuf%[email protected]> > > >> > > . > >> > > For more options, visit this group at > >> > >http://groups.google.com/group/protobuf?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Protocol Buffers" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<protobuf%[email protected]> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/protobuf?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Protocol Buffers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<protobuf%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
