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>
Answer from David on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 42969716 › how-to-import-org-json-in-maven-using-dependency
java - How to import org.json in maven using dependency - Stack Overflow
@JFMeier For other dependencies such as spring and hibernate,junit,apache commons,java-mail,servlet dependencies everything is fine. and works perfectly. when i am keeping "json" maven dependency in pom.xml, i am getting that error ... I don't want to be impolite, but could you try to answer my two questions above: Which workflow let to this error? Did you try the command line? ... You are right.My repository was broken and spring .framework.jdbc and spring.framework.core dependency versions were missing. so i added them and now added json.
Discussions

java - JSONObject ClassNotFoundException - Stack Overflow
This is the latest dependency & it don't seems to have "import org.json.JSONObject;". Could you please guide ASAP? More on stackoverflow.com
🌐 stackoverflow.com
java - json dependency added in pom.xml get error - Stack Overflow
I am working with Sparse Matrix in my project. To build a Sparse Matrix I am using Universal Java Matrix Package. I add all the dependency in my pom.xml file.My pom.xml file is like that. More on stackoverflow.com
🌐 stackoverflow.com
July 12, 2018
rest - JSON Dependency not working in Maven pom.xml - Stack Overflow
i am working on JAX-RS with Jersey, i have a resource class that return data to the client, i am able to return xml data as responce, but it's not working when i am trying to return JSON, i got the More on stackoverflow.com
🌐 stackoverflow.com
The curious case of JSON-Java (org.json) and Maven's dependency "hell"
The dependency tree by default exclude duplicates. You can do "mvn dependency:tree -Dverbose=true -DoutputFile=./tree.txt" and look at all inclusions of the specific library. But dependency exclusion is not the best way for your case. It is better to define your desired version within the "" section. You can verify the result by using a verbose output of the dependency:tree goal. More on reddit.com
🌐 r/java
29
25
July 19, 2025
🌐
CodePal
codepal.ai › code generator › add json dependency to pom.xml | java function
Add JSON Dependency to pom.xml | Java Function - CodePal
June 14, 2024 - By following the provided code examples and instructions, you can easily incorporate JSON functionality into your Java project. Happy coding! ... import org.apache.maven.model.Dependency; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import java.io.FileReader; import java.io.FileWriter; ... This class provides a method to add a JSON dependency with version 1.12.2 to a Maven project’s pom.xml file.
🌐
MuleSoft
docs.mulesoft.com › json-module › latest › json-xml-maven
JSON Module XML and Maven Support | MuleSoft Documentation
If you code a Mule app manually, include this XML snippet in your pom.xml file to enable access to this connector: <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-json-module</artifactId> <version>x.x.x</version> <classifier>mule-plugin</classifier> </dependency>
🌐
RoseIndia
roseindia.net › maven › releases › org.json-json-20210307-released.shtml
Maven dependency for org.json - json version 20210307 is released. Learn to use json version 20210307 in Maven based Java projects
March 7, 2021 - Now the next step is to use the latest dependency for maven of the org.json - braid library library in the pom.xml fie of your project.
Find elsewhere
🌐
Reddit
reddit.com › r/java › the curious case of json-java (org.json) and maven's dependency "hell"
r/java on Reddit: The curious case of JSON-Java (org.json) and Maven's dependency "hell"
July 19, 2025 -

Hi. I have a recurring maven(?) issue that I hope is not unique to me and has been solved by someone somewhere.

As JSON parser, I use JSON-Java (the one with package org.json), instead of more famous ones, as the DX and API feel more fit for most/all my projects.

However, from time to time, I reach a very dreadful situation, where the "version" of the JSON-Java library that is available to my code is "not" the one that I have declared in my pom.xml file. In once case, the copyright notice in the source that I could see by clicking the class name in VSCode was from 2010, with the painful difference to the modern version that all parsing methods threw checked exceptions. In another instance, the JSONArray class did not implement Iterable/Iterator where in modern versions it does.

This is likely a maven transitive dependency issue, but the reason it is so visible for this particular library, is because either many libraries already have their own dependency on it, or that it's interface has evolved quite significantly along the way. Likely both.

The solution "in the book" for this is apparently to do "mvn dependency:tree" and exclude JSON-Java explicitly from other dependencies that depend on it. But it doesn't work for me! In my dependency three, only the recent version that is in my own pom file is shown, whereas in code/IDE (VSCode + IntelliJ), I can only use the old version. My deployment involves building a fat Jar, so it happens there too.

Am I doing something wrong? Is there a proven way to make only a certain version of a dependency available to my code, regardless of other versions that may be present deeper in the class path? Does the order of dependencies in pom file matter? and how can I strictly control the versions of dependencies that appear in my fat jar, in case it is possible at all?

Many thanks

🌐
Sourcecodeexamples
sourcecodeexamples.net › 2019 › 12 › json-maven-dependency.html
json maven dependency
December 3, 2019 - It also includes the capability to convert between JSON and XML, HTTP headers, Cookies, and CDL. This is a reference implementation. There is a large number of JSON packages in Java. Copy below JSON In Java maven dependency and paste in your project pom.xml file:
🌐
MuleSoft
docs.mulesoft.com › json-module › 2.1 › json-xml-maven
JSON Module XML and Maven Support - Mule 4 | MuleSoft Documentation
If you code a Mule app manually, include this XML snippet in your pom.xml file to enable access to this connector: <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-json-module</artifactId> <version>x.x.x</version> <classifier>mule-plugin</classifier> </dependency>
🌐
Maven Central
central.sonatype.com › artifact › org.json › json
org.json:json - Maven Central
<dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20251224</version> </dependency> Copy to clipboard · <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20251224</version> <packaging>bundle</packaging> <name>JSON in Java</name> <description> JSON is a light-weight, language independent, data interchange format.
🌐
GitHub
github.com › syndesisio › syndesis › issues › 6292
server/endpoint/pom.xml issue with org.json:json dependency · Issue #6292 · syndesisio/syndesis
I'm not sure how to respond to this - if I exclude org.json:json from openshift-client (which is bringing it in), then I get an error · [INFO] --- dependency-management-maven-plugin:0.11:analyze (basepom.default) @ server-endpoint --- [ERROR] Exclusions must be removed for managed dependency io.fabric8:openshift-client:jar · If I add a dependency to server/endpoint for org.json:json, I get a complaint that android-json has classes that are duplicated from org.json:json.
🌐
javathinking
javathinking.com › blog › how-to-add-dependency-of-other-maven-project-to-my-current-maven-project-in-java-eclipse
How to Add a Maven Project Dependency to Your Current Project in Java Eclipse: Step-by-Step Guide for Beginners — javathinking.com
Maven dependencies are hosted on Maven Central Repository (the default repository for Maven). To find the dependency you need: Open your browser and go to Maven Central Repository. Search for the library you want to add.
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json › 20210307
Maven Repository: org.json » json » 20210307
March 9, 2021 - 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.
Published   Mar 09, 2021
Version   20210307
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json
Maven Repository: org.json » json
December 24, 2025 - 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.
🌐
Stack Overflow
stackoverflow.com › questions › 75021192 › org-json-is-not-accessible-in-java-maven-project-as-a-dependency
org.json.* is not accessible in JAVA Maven Project as a dependency - Stack Overflow
Lastly, I tried to download the json-java.jar from github and add it into a libs folder on the base project directory and added it in the pom file as a dependency but it could not be resolved either. ... <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>books</artifactId> <version>1.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.s
🌐
Maven Central
central.sonatype.com › artifact › org.json › json › 20220924
org.json:json:20220924 - Maven Central - Sonatype
<dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20220924</version> </dependency> Copy to clipboard · <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20220924</version> <packaging>bundle</packaging> <name>JSON in Java</name> <description> JSON is a light-weight, language independent, data interchange format.
🌐
Stack Overflow
stackoverflow.com › questions › 74850319 › the-pom-for-org-jsonjsonjar20210118-is-missing-no-dependency-information-ava
java - The POM for org.json:json:jar:20210118 is missing, no dependency information available - Stack Overflow
December 19, 2022 - <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20220924</version> </dependency> ... Sign up to request clarification or add additional context in comments. ... thanks for suggestion.... maven.apache.org/POM/4.0.0 is my maven version which version is suitable for this version?