Add json jar to your classpath

or use java -classpath json.jar ClassName

Or add this to your maven pom.xml depedencies:

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20090211</version>
</dependency>
Answer from Alya'a Gamal on Stack Overflow
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json
Maven Repository: org.json » json
December 24, 2025 - JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write · 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.
Discussions

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
30
25
July 19, 2025
org.json.* is not accessible in JAVA Maven Project as a dependency - Stack Overflow
Remove bundle and try again. See What is the meaning of type "bundle" in a maven dependency? for more info. ... I did that and there were no errors on pom but I still could not reference it in my code. I get this error: The type org.json.JSONArray is not accessible More on stackoverflow.com
🌐 stackoverflow.com
java - org.json.simple cannot be resolved - Stack Overflow
If you never downloaded it, you ... findjar.com/class/org/json/simple/JSONArray.html 2012-10-31T09:54:02.29Z+00:00 ... Ok. I have it. The eclipse (android) directory is /libs . Thanx 2012-10-31T09:55:21.627Z+00:00 ... I was facing same issue in my Spring Integration project. I added below JSON dependencies in pom.xml ... More on stackoverflow.com
🌐 stackoverflow.com
java - How to import org.json in maven using dependency - Stack Overflow
I want to use JSON as an interaction between Client and Server. But I am getting an error like this: pom.xml More on stackoverflow.com
🌐 stackoverflow.com
🌐
Maven Repository
mvnrepository.com › artifact › org.json
Maven Repository: org.json
JSON framework based on org.json implementation (patched for ChargeBee). ... aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension framework github gradle groovy io ios javascript jvm kotlin library logging maven mobile ...
🌐
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

🌐
Maven Central
central.sonatype.com › artifact › org.json › json
org.json:json - Maven Central
<dependency> <groupId>org.json...1224</version> <packaging>bundle</packaging> <name>JSON in Java</name> <description> JSON is a light-weight, language independent, data interchange format....
🌐
Maven Repository
mvnrepository.com › artifact › com.googlecode.json-simple › json-simple › 1.1
Maven Repository: com.googlecode.json-simple » json-simple » 1.1
Dependency Injection · XML Processing · Web Frameworks · Android Platform · Concurrency Libraries · Defect Detection Metadata · Code Generators · Top Categories · Home » com.googlecode.json-simple » json-simple » 1.1 · A simple Java toolkit for JSON · Note: There is a new version for this artifact · Maven ·
🌐
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
Remove <type>bundle</type> and try again. See What is the meaning of type "bundle" in a maven dependency? for more info. ... I did that and there were no errors on pom but I still could not reference it in my code. I get this error: The type org.json.JSONArray is not accessible
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json-simple
Maven Repository: org.json » json-simple
JSON Libraries · Core Utilities · Mocking · Web Assets · Annotation Libraries · HTTP Clients · Language Runtime · Logging Bridges · Dependency Injection · XML Processing · Web Frameworks · Android Platform · Concurrency Libraries · Defect Detection Metadata · Code Generators · Top Categories · Home » org.json » json-simple ·
Find elsewhere
🌐
Jar-download
jar-download.com › maven-repository-class-search.php
Download dependencies for java class org.json.JSONArray
Here you can download the dependencies for the java class org.json.JSONArray. Use this engine to looking through the maven repository.
🌐
Cliftonlabs
cliftonlabs.github.io › json-simple
json-simple
August 7, 2019 - <dependency> <groupId>com.github.cliftonlabs</groupId> <artifactId>json-simple</artifactId> <version>4.0.1</version> </dependency> View the repository's change log to see what is new. Report bugs or request features at the repository's issues page. Browse the json-simple latest release javadocs. See these features in action in the example. JsonArray extends java.util.ArrayList so it is compatible with all interfaces and utilities that use them.
🌐
GitHub
github.com › stleary › JSON-java › blob › master › docs › RELEASES.md
JSON-java/docs/RELEASES.md at master · stleary/JSON-java
Contains the latest code as of 7 Aug 2016 20160212 Java 1.6 compatibility, OSGi bundle. Contains the latest code as of 12 Feb 2016. 20151123 JSONObject and JSONArray initialization with generics. Contains the latest code as of 23 Nov 2015. 20150729 Checkpoint for Maven central repository release.
Author   stleary
🌐
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
<?xml version="1.0" encoding="UTF-8"?> <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.ssts</groupId> <artifactId>momcab1</artifactId> <name>momcab1</name> <packaging>war</packaging> <version>1.0.0-BUILD-SNAPSHOT</version> <properties> <java-version>1.7</java-version> <org.springframework-version>4.0.3.RELEASE</org.springframework-version> <org.aspectj-version>1.7.4</org.aspectj-version> <org.sl
🌐
DigitalOcean
digitalocean.com › community › tutorials › json-simple-example
json-simple example | DigitalOcean
August 4, 2022 - <dependency> <groupId>com.goog... into it. JSONObject toJSONString method returns the JSON in String format that we can write to file. For writing list to a JSON key, we can use org.json.simple.JSONArray....
🌐
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
🌐
Sourcecodeexamples
sourcecodeexamples.net › 2019 › 12 › json-maven-dependency.html
json maven dependency
December 3, 2019 - <!-- https://mvnrepository.com/artifact/org.json/json --> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20190722</version> </dependency> For more details about the proper version to use, check out the following Maven Central link.
🌐
QA Automation Expert
qaautomation.expert › tag › json-maven-dependency
Json Maven Dependency – QA Automation Expert
June 3, 2021 - The values can be any of these types: Boolean, JSONArray, JSONObject, Number, String, or JSONObject.NULL object. To create a request body using JSON Object, we need to add a Maven dependency. <dependencies> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20240303</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>5.5.0</version> <scope>test</scope> </dependency> </dependencies>
🌐
TutorialsPoint
tutorialspoint.com › org_json › org_json_quick_guide.htm
Org.Json - Quick Guide
Set the JSON_JAVA environment variable to point to the base directory location where org.json jar is stored on your machine. Let's assuming we've stored json-20250517.jar in the JSON folder. Set the CLASSPATH environment variable to point to the JSON.simple jar location. CDL class provides static methods to convert a comma delimited text into a JSONArray, and vice versa.
🌐
Maven Repository
mvnrepository.com › open-source › json-libraries
Maven Repository: JSON Libraries
JSON parsing, generation, and serialization libraries for working with JSON data.