Which Json/JSON package I have to use?

523 views
Skip to first unread message

Alex Ph

unread,
Mar 5, 2015, 4:32:55 AM3/5/15
to google-we...@googlegroups.com
Hi all,
I want to upgrade from 2.6.1 to 2.7.0 and I use autobeans to handle JSON data. Due to json-issues (like https://code.google.com/p/google-web-toolkit/issues/detail?id=8762) you moved/removed the org.json package and I have to reorg my imports.

I have three options to replace my old org.json.JSONObject import and I wonder which import I have to choose:

1) com.google.gwt.thirdparty.json.JSONObject (used by Autobean)
2) com.google.gwt.json.client.JSONObject
3) com.google.gwt.dev.json.JsonObject

Any Hints here?

Thanks
Alex

Thomas Broyer

unread,
Mar 5, 2015, 5:26:07 AM3/5/15
to google-we...@googlegroups.com


On Thursday, March 5, 2015 at 10:32:55 AM UTC+1, Alex Ph wrote:
Hi all,
I want to upgrade from 2.6.1 to 2.7.0 and I use autobeans to handle JSON data. Due to json-issues (like https://code.google.com/p/google-web-toolkit/issues/detail?id=8762) you moved/removed the org.json package and I have to reorg my imports.

I have three options to replace my old org.json.JSONObject import and I wonder which import I have to choose:

If you use AutoBeans, why do you need org.json?
Anyway, if you need org.json, add it as a dependency (download the JAR, or add the dependency to your pom.xml or build.gradle or ivy.xml or whatever you're using) and use it (and comply with its license).

1) com.google.gwt.thirdparty.json.JSONObject (used by Autobean)

Anything in c.g.g.thirdparty can change without notice between GWT versions, so it could very well disappear in the next version of GWT.
 
2) com.google.gwt.json.client.JSONObject

This is only usable in client-side code; won't work where you used to use org.json.
 
3) com.google.gwt.dev.json.JsonObject

Isn't in gwt-servlet.jar AFAIK, so won't be available at runtime.
 
Any Hints here?

There's also elemental.json but it's still experimental.

No, really, if you're happy with org.json, then just continue using it; all you have to do is add it to your classpath.

Alex Ph

unread,
Mar 5, 2015, 5:58:49 AM3/5/15
to google-we...@googlegroups.com
Hi,
thnx for the fast response :)


Am Donnerstag, 5. März 2015 11:26:07 UTC+1 schrieb Thomas Broyer:


On Thursday, March 5, 2015 at 10:32:55 AM UTC+1, Alex Ph wrote:
Hi all,
I want to upgrade from 2.6.1 to 2.7.0 and I use autobeans to handle JSON data. Due to json-issues (like https://code.google.com/p/google-web-toolkit/issues/detail?id=8762) you moved/removed the org.json package and I have to reorg my imports.

I have three options to replace my old org.json.JSONObject import and I wonder which import I have to choose:

If you use AutoBeans, why do you need org.json?
Because I was blind and I didn't see that we only use json.org stuff in our test cases to load test.json files....
Anyway, if you need org.json, add it as a dependency (download the JAR, or add the dependency to your pom.xml or build.gradle or ivy.xml or whatever you're using) and use it (and comply with its license).
I think I should have a look at the json licence :)

Thnx for your explanation of the three type of JsonObjects

Best regards
Alex 
Reply all
Reply to author
Forward
0 new messages