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 - There are a large number of JSON packages in Java. Perhaps someday the Java community will standardize on one. Until then, choose carefully. ... 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 ...
🌐
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

🌐
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
🌐
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.
🌐
Maven Central
central.sonatype.com › artifact › org.json › json
org.json:json - Maven Central
</description> <url>https://gi... module org.json { exports org.json; } </moduleInfoSource> </module> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.3.0</version> ...
🌐
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 ...
🌐
GitHub
github.com › stleary › JSON-java
GitHub - stleary/JSON-java: A reference implementation of a JSON package in Java. · GitHub
The org.json package can be built from the command line, Maven, and Gradle. The unit tests can be executed from Maven, Gradle, or individually in an IDE e.g.
Starred by 4.7K users
Forked by 2.6K users
Languages   Java
🌐
Maven Central
repo1.maven.org › maven2 › org › json › json › 20230227
Central Repository: org/json/json/20230227
org/json/json/20230227 · / json-20230227-javadoc.jar 2023-02-27 13:38 185665 json-20230227-javadoc.jar.asc 2023-02-27 13:38 659 json-20230227-javadoc.jar.md5 2023-02-27 13:38 32 json-20230227-javadoc.jar.sha1 2023-02-27 13:38 40 json-20230227-sources.jar 2023-02-27 13:38 70293 json-202302...
Find elsewhere
🌐
Maven Central
central.sonatype.com › artifact › org.json › json › 20230227
org.json:json:20230227 - Maven Central - Sonatype
<dependency> <groupId>org.json...0227</version> <packaging>bundle</packaging> <name>JSON in Java</name> <description> JSON is a light-weight, language independent, data interchange format....
🌐
SourceForge
json-lib.sourceforge.net
Maven - Json-lib::Welcome
The function type from javascript is not part of the JSON format "officially" (please refer to http://www.json.org) but it is supported as well. Json-lib comes in two flavors, depending on the jdk compatibility. json-lib-x.x-jdk13 is compatible with JDK 1.3.1 and upwards. json-lib-x.x-jdk15 is compatible with JDK 1.5, includes support for Enums in JSONArray and JSONObject.
🌐
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
🌐
DigitalOcean
digitalocean.com › community › tutorials › json-simple-example
json-simple example | DigitalOcean
August 4, 2022 - package com.journaldev.json.write; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.util.Iterator; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; public class JsonSimpleReader { public static void main(String[] args) throws ParseException, FileNotFoundException, IOException { JSONParser parser = new JSONParser(); Reader reader = new FileReader("data.json"); Object jsonObj = parser.parse(reader); JSONObject j
🌐
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 Central Repository
search.maven.org › org.json › json › 20180813
Maven Central Repository Search
There is a large number of JSON packages in Java. Perhaps someday the Java community will standardize on one. Until then, choose carefully. The license includes this restriction: "The software shall be used for good, not evil." If your conscience cannot live with that, then choose a different package. ... <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20180813</version> </dependency>
🌐
Jar-Download
jar-download.com › home › org.datanucleus › datanucleus-json › 2.1.0-release › source code › jsonarray.java
org.json.JSONArray Maven / Gradle / Ivy
August 2, 2025 - org.json.JSONArray maven / gradle build tool code. The class is part of the package ➦ Group: org.datanucleus ➦ Artifact: datanucleus-json ➦ Version: 2.1.0-release
🌐
Maven Repository
mvnrepository.com › open-source › json-libraries
Maven Repository: JSON Libraries
JSON parsing, generation, and serialization libraries for working with JSON data.
🌐
Cliftonlabs
cliftonlabs.github.io › json-simple
json-simple
Download json-simple's latest release jar, javadocs, and source. runtime 'com.github.cliftonlabs:json-simple:4.0.1' <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.
🌐
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
I should mention that I tried it on a new java project (without maven) and it works fine, by importing the .jar file from git-hub repository ... 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
🌐
Java2s
java2s.com › Open-Source › Maven_Repository › JSON › org.json › org_json_chargebee_1_0.htm
Maven Repository - POM file for JSON org.json chargebee-1.0 chargebee-1.0
1 month ago - The following plugins are used in the org.json-chargebee-1.0.jar ... Here is the content of the POM file. <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>org.json</groupId> <artifactId>org.json</artifactId> <packaging>jar</packaging> <version>chargebee-1.0</version> <name>org-json-java</name> <description>JSON framework based on org.json implementation (patched for ChargeBee).</description> <url>htt