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.
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
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
I need to read json file using Java jar maven process if anyone could you please provide me reference projects it will help me a lot
https://github.com/google/gson More on reddit.com
🌐 r/programming
4
0
July 28, 2023
Can't import "json-20240303" library into my project.
Show your pom.xml More on reddit.com
🌐 r/javahelp
7
2
June 17, 2024
🌐
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 › 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 module npm osgi persistence plugin resources rlang sdk server service spring sql starter testing tools ui web webapp
🌐
Jar-Download
jar-download.com › home › com.github.cliftonlabs › json-simple › 2.1.2 › source code › jsonobject.java
org.json.simple.JSONObject Maven / Gradle / Ivy
org.json.simple.JSONObject maven / gradle build tool code. The class is part of the package ➦ Group: com.github.cliftonlabs ➦ Artifact: json-simple ➦ Version: 2.1.2
🌐
DigitalOcean
digitalocean.com › community › tutorials › json-simple-example
json-simple example | DigitalOcean
August 4, 2022 - Since json-simple is available in maven central repository, best way is to add it’s dependency in pom.xml file. <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1.1</version> </dependency> Most important class in json-simple API is org.json.simple.JSONObject.
🌐
GitHub
github.com › stleary › JSON-java
GitHub - stleary/JSON-java: A reference implementation of a JSON package in Java. · GitHub
The unit tests can be executed from Maven, Gradle, or individually in an IDE e.g. Eclipse. ... import org.json.JSONObject; public class Test { public static void main(String args[]){ JSONObject jo = new JSONObject("{ \"abc\" : \"def\" }"); System.out.println(jo); } }
Starred by 4.7K users
Forked by 2.6K users
Languages   Java
🌐
Cliftonlabs
cliftonlabs.github.io › json-simple
json-simple
After redesigning the library to be backwards compatible it was decided that support for java 2 to 6 would be dropped in favor of generics (thus a 2.* version) as it was the most avidly requested feature. The library was also written in the package org.json.simple so a maven artifact under the org.json.simple groupId made sense.
Find elsewhere
🌐
Baeldung
baeldung.com › home › json › introduction to json-java (org.json)
Introduction to JSON-Java (org.json)
June 20, 2025 - We can get the latest version from the Maven Central Repository. However, let’s not include the dependency explicitly when using the Android SDK, since it already includes the package. We use classes from the JSON-Java library to parse and manipulate JSON in Java. We also know this library as org.json. However, we should not confuse it with Google’s org.json.simple library.
🌐
JavaMadeSoEasy
javamadesoeasy.com › 2018 › 09 › reading-json-using-jsonsimplejsonobject.html
JavaMadeSoEasy.com (JMSE): Reading JSON using json.simple.JSONObject in java
We can use Jackson api for for processing JSON in java. ... Solve [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven: Compilation failure: Compilation failure: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)
🌐
Jar-Download
jar-download.com › home › org.json › json › 20180130 › source code › jsonobject.java
org.json.JSONObject Maven / Gradle / Ivy
This is the most * commonly used JSONObject constructor. * * @param source * A string beginning with { (left * brace) and ending with } * (right brace). * @exception JSONException * If there is a syntax error in the source string or a * duplicated key. */ public JSONObject(String source) throws JSONException { this(new JSONTokener(source)); } /** * Construct a JSONObject from a ResourceBundle.
🌐
Maven Repository
mvnrepository.com › artifact › com.googlecode.json-simple › json-simple › 1.1
Maven Repository: com.googlecode.json-simple » json-simple » 1.1
A simple Java toolkit for JSON · Note: There is a new version for this artifact · Maven · Gradle · SBT · Mill · Ivy · Grape · Leiningen · Buildr · Scope: compile · test · provided · runtime · Scope: compile · test · provided · runtime · Format: Groovy Long ·
🌐
Bukkit
bukkit.org › threads › problem-loading-libraries-with-maven-java-lang-noclassdeffounderror-org-json-jsonobject.428354
Solved - Problem loading libraries with Maven... "java.lang.NoClassDefFoundError: org/json/JSONObject" | Bukkit Forums
August 9, 2016 - Hey everybody. So I'm having a bit of trouble just using an external library, in this case, org.json (though it's the same problem for any 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

🌐
Maven Repository
mvnrepository.com › artifact › org.json › json-simple
Maven Repository: org.json » json-simple
Indexed Artifacts (63.6M) · Popular Categories · Testing Frameworks & Tools · Android Packages · JVM Languages · Logging Frameworks · Java Specifications · JSON Libraries · Core Utilities · Mocking
🌐
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....
🌐
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
🌐
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.
🌐
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
I even tried using json-simple-1.1.1 dependency and json-simple-1.1 dependency and json-20140107 dependency. Error is still the same. So I don't know what is going on. So anyone help me to get the right JSON dependency in pom.xml · Finally I should import these · import org.json.JSONException; import org.json.JSONObject; java · json · maven ·
🌐
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