Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.json JAR provisioning

Tags:

json

jar

I was wondering why www.json.org/anyone else doesn't provide an official JAR package of org.json for download? All queries I find of people asking where they can download the JAR results in replies to the page which just lists the source files.

It seems a bit cumbersome to expect everybody to download each source file and prepare the JAR file themselves.

like image 444
pilcrowpipe Avatar asked May 01 '12 10:05

pilcrowpipe


People also ask

What is org JSON jar?

JSON is a light-weight, language independent, data interchange format. See http://www.JSON.org/ The files in this package implement JSON encoders/decoders in Java. It also includes the capability to convert between JSON and XML, HTTP headers, Cookies, and CDL.

Where can I download org JSON?

org. json is now regularly updated in the Maven repository. The latest release is 12 Feb, 2016: http://mvnrepository.com/artifact/org.json/json.

What is the use of Org JSON?

json or JSON-Java is a simple Java based toolkit for JSON. You can use org. json to encode or decode JSON data.


4 Answers

Have you considered using Maven? for instance, if you wanted a JAR to pars JSON you could just include...

http://mvnrepository.com/artifact/org.codehaus.jackson/jackson-core-asl/1.9.6

<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-core-asl</artifactId>
    <version>1.9.6</version>
</dependency>

in a pom.xml, this will give you the jar for JSON.

Or better yet, use the org.json one...

http://mvnrepository.com/artifact/org.json/json

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20090211</version>
</dependency>
like image 78
david99world Avatar answered Oct 31 '22 22:10

david99world


I downloaded a jar from here: http://code.google.com/p/org-json-java/downloads/detail?name=org.json-20120521.jar&can=2&q=

like image 44
cellepo Avatar answered Nov 01 '22 00:11

cellepo


The implementation from json.org by Douglas Crockford is nōn-free. Luckily, a Free almost drop-in replacement exists (apparently, Google’s code packaged by someone else for Maven Central):

<dependency>
    <groupId>com.vaadin.external.google</groupId>
    <artifactId>android-json</artifactId>
    <version>0.0.20131108.vaadin1</version>
</dependency>

Add this to pom.xml instead of using the json.org one. We had to do only one minor change to our code for this: the vaadin one can throw JSONException in more places, so we had to either catch them or pass them through to the callers (extend the throws declaration).

like image 35
mirabilos Avatar answered Oct 31 '22 23:10

mirabilos


Beware that the json.org software has a non-open source license. This causes downstream problems in many cases.

The issue is that the license is essentially the MIT license, but it adds a line that says that the software should only be used for good, not evil. This sounds fine, but if you have to get a corporate lawyer to sign off it gets nasty because there is no consensus legal definition of "evil". If you use json.org's library, you can't put your software into Debian, for instance. Your software likewise can't be a dependency for any Apache project.

To help with this, I have adapted and packaged the android clean-room rewrite of the json.org library. The source is on github and is Apache licensed. See https://github.com/tdunning/open-json. To use this, add something like this to your pom (or equivalent):

<!-- https://mvnrepository.com/artifact/com.tdunning/json -->
<dependency>
    <groupId>com.tdunning</groupId>
    <artifactId>json</artifactId>
    <version>1.3</version>
</dependency>

Ping me with pull requests or issues on github or however you like.

like image 45
Ted Dunning Avatar answered Oct 31 '22 22:10

Ted Dunning