Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json encoding in v3 #350

Closed
ekg opened this issue May 7, 2015 · 11 comments
Closed

json encoding in v3 #350

ekg opened this issue May 7, 2015 · 11 comments

Comments

@ekg
Copy link

ekg commented May 7, 2015

I see that JSON encoding is in the works for protobuf v3. What is the timeline for this feature, and is there any simple way to help out? (I'm keen to help as I'm using and helping out with an independent json serializer for protobuf.)

@xfxyjwf
Copy link
Contributor

xfxyjwf commented May 7, 2015

(Assuming you are talking about C++) Currently we are doing the development in our internal code base so we can't accept external contributions. The plan is to have it open-sourced this quarter. Thanks for offering help though.

Java has a similar timeline to C++, whereas the initial release of objective-c and javanano will not have JSON support. For ruby, I think JSON is already supported.

@vanvlack
Copy link

@xfxyjwf wondering if your timelines on JSON encoding is still holding true?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jul 16, 2015

@vanvlack, JSON support for C++ is added. See: https://github.com/google/protobuf/blob/master/src/google/protobuf/util/json_util.h
We may add some more convenient methods to make it easier to use.

For Java, I'm working on it right now and it should be ready soon.

@vanvlack
Copy link

For Java, I'm working on it right now and it should be ready soon.

Great news @xfxyjwf. Is it possible to define ready soon? Like is that days, weeks, months?

@borud
Copy link

borud commented Aug 21, 2015

What solution do you recommend while we're waiting for JSON support in Java? Preferably something that requires minimum of changes when the JSON support gets released.

@IceMan81
Copy link

@xfxyjwf Do you have a sense of when JSON support in Java might be available?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Aug 28, 2015

@IceMan81 check out this JsonFormat class:
https://github.com/google/protobuf/blob/beta-1/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java

It's in the beta-1 branch. We will merge it back to master soon. A binary package "protobuf-java-util" is also available on maven now:
http://mvnrepository.com/artifact/com.google.protobuf/protobuf-java-util/3.0.0-beta-1

@borud
Copy link

borud commented Sep 3, 2015

Is this the solution that will be supported in the future or will protobuffer objects get something convenient like a .toJson() method? (And possibly a version of the method that takes a Writer or similar).

I'd really like that convenience.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 16, 2015

In C++ and Java, it will not be added to the message interface but will be kept as separate utility functions/classes. This is due to dependency restrictions in our internal code base (we cannot make the Message interface depend on the JSON util).

In other languages though, it might be possible to make it part of the message interface so you can call toJson on a proto object directly. It needs to be decided per language though.

@borud
Copy link

borud commented Nov 17, 2015

@xfxyjwf I'm going to ask a stupid question: what is the restriction? License? Not wanting to depend on some external library?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jan 20, 2016

Re @borud , the restrictions are from how we manage the layout of our internal code bases. It's not related to license or external dependencies.

@xfxyjwf xfxyjwf closed this as completed Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants