So you need to include JSON libraries in your Maven project. The only option that seems to be currently available is using json-lib with the following dependencies:
| <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.3</version> <classifier>jdk15</classifier> </dependency> |
The APIs are based upon the original work done at json.org/java.
If you are using NetBeans for adding the Maven dependency then it nicely shows the different versions for the artifact as shown below:

The usage guide and samples at json-lib have lots of documentation to get you started. Don’t forget the package names are changed so “org.json.JSONObject” is ”net.sf.json.JSONObject” and similarly other classes.
Please leave suggestions on other TOTD (Tip Of The Day) that you’d like to see. A complete archive of all the tips is available here.
Technorati: json maven json-lib netbeans
Related posts:- TOTD #56: Simple RESTful Web service using Jersey and Embeddable GlassFish – Text and JSON output
- TOTD #10: Consuming JSON and XML representations generated by a Jersey endpoint in a jMaki Table widget
- TOTD #8: Generating JSON using JAXB annotations in Jersey
- TOTD #36: Deploy OSGi bundles in GlassFish using maven-bundle-plugin
- Language-neutral data format: XML and JSON
I use http://code.google.com/p/google-gson/ which also has a Maven repo available.
Comment by Mikael Gueck — August 7, 2009 @ 3:30 am
"The only option that seems to be currently available is using json-lib …" Gson library is available at gson.googlecode.com/svn/mavenrepo
Comment by Michael Krasnovsky — August 7, 2009 @ 3:30 am
wow, very nice and incredible post about _.
i visited many blogs but couldn’t find
such valuable info. i will definetly add
this to my blogroll.
Comment by Cheap Tickets — August 11, 2009 @ 2:50 am
I am common with all these but it all looks completed at this time of the day, but thanks for the great info..
Comment by Payday Loans — August 13, 2009 @ 3:31 pm