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 ...
🌐
Maven Central
central.sonatype.com › artifact › org.json › json
org.json:json - Maven Central
pkg:maven/org.json/json@20251224 · Used in: 1199 components · Overview · Overview · Versions · Versions · Dependents · Dependents · Dependencies · Dependencies · JSON is a light-weight, language independent, data interchange format. See http://www.JSON.org/ The files in this package ...
Discussions

java - JSONObject ClassNotFoundException - Stack Overflow
I am working in IntelliJ and using Maven. I have a class that uses JSONObject: import org.json.JSONObject; try { JSONObject documentObj = new JSONObject(document); } catch (Exception e) { throw new RuntimeException("Failed to convert JSON String to JSON Object.", e); } ... org.json json 20090211 I can do a mvn clean package and builds successfully. But when I try to run it, I get: Error: java... 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
org.json JAR provisioning - Stack Overflow
Just a quick warning... the version of org.json that's available in the maven repo is much older that the current release on github github.com/douglascrockford/JSON-java. I had some issues with the maven release that I assume were bugs that were fixed because using the latest release directly ... 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
🌐
Maven Repository
mvnrepository.com › open-source › json-libraries
Maven Repository: JSON Libraries
JSON parsing, generation, and serialization libraries for working with JSON data. ... Gson is a Java library that can be used to convert Java Objects into their JSON representation.
🌐
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
🌐
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

🌐
SourceForge
json-lib.sourceforge.net
Maven - Json-lib::Welcome
Json.org | Maven 2 · Introduction ... FAQ · Changes · Javadoc (jdk13) Javadoc (jdk15) JSON-lib is a java library for transforming beans, maps, collections, java arrays and XML to JSON and back again to beans and DynaBeans....
Find elsewhere
🌐
Maven Central Repository
search.maven.org › org.json › json › 20180813
Maven Central Repository Search
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. </description> <url>https://github.com/douglascrockford/JSON-java</url> <parent> <groupId>org.sonatype.oss</groupId> <artifactId>oss-parent</artifactId> <version>9</version> </parent> <scm> <url>https://github.com/douglascrockford/JSON-java.git</url> <connection>scm:git:git://github.com/douglascrockford/JSON-java.git</connection> <developerConne
🌐
Reddit
reddit.com › r/programming › 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
r/programming on Reddit: 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
July 28, 2023 - Add Maven dependency: Include the required library for parsing JSON data. For this, you can use the Jackson library. Add the following dependency to your project's pom.xml file: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.12.5</version> <!-- Use the latest version available --> </dependency> 3. Place the JSON file: Put the JSON file you want to read in your project's resources directory.
🌐
DEV Community
dev.to › alexmercedcoder › how-to-build-a-java-spring-json-api-from-a-blank-maven-project-311m
How to build a Java Spring JSON API from a blank maven project - DEV Community
October 1, 2023 - mvn archetype:generate -DgroupId=com.example -DartifactId=todocrud -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
🌐
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
🌐
GitHub
github.com › stleary › JSON-java › blob › master › docs › RELEASES.md
JSON-java/docs/RELEASES.md at master · stleary/JSON-java
JSON-java releases can be found by searching the Maven repository for groupId "org.json" and artifactId "json".
Author   stleary
🌐
JAXB
javaee.github.io › jsonb-spec › getting-started.html
JSON Binding (JSON-B) - Getting started
<repositories> <!-- Needed for JSON-B API --> <repository> <id>java.net-Public</id> <name>Maven Java Net Snapshots and Releases</name> <url>https://maven.java.net/content/groups/public/</url> </repository> </repositories>
🌐
Maven Central
central.sonatype.com › artifact › org.json › json › 20230227
org.json:json:20230227 - Maven Central - Sonatype
pkg:maven/org.json/json@20230227 · Used in: 26751 components · Overview · Overview · Versions · Versions · Dependents · Dependents · Dependencies · Dependencies · JSON is a light-weight, language independent, data interchange format. See http://www.JSON.org/ The files in this package ...
🌐
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. Copy below JSON In Java gradle dependency and paste in your project build.gradle file:
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json › 20180130
Maven Repository: org.json » json » 20180130
There are a large number of JSON packages in Java. Perhaps someday the Java community will standardize on one. Until then, choose carefully. ... aar amazon 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 maven ...
🌐
Baeldung
baeldung.com › home › json › introduction to json-java (org.json)
Introduction to JSON-Java | Baeldung
June 20, 2025 - In this tutorial, we’ll see how to create, manipulate, and parse JSON using one of the available JSON processing libraries in Java – the JSON-Java library, also known as org.json. First, let’s add the following dependency in our pom.xml: <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20250517</version> </dependency> We can get the latest version from the Maven Central Repository.
🌐
Maven Repository
mvnrepository.com › artifact › javax.json › javax.json-api
Maven Repository: javax.json » javax.json-api
November 7, 2018 - Javax JSON · Links · Java Specifications · Maven Plugins · Testing · Android Packages · Language Runtime · JVM Languages · Logging Frameworks · JSON Libraries · Java Specifications · Core Utilities · Mocking · Annotation Libraries · Web Assets ·
🌐
Maven Central
central.sonatype.com › artifact › org.json › json › 20220924
org.json:json:20220924 - Maven Central - Sonatype
pkg:maven/org.json/json@20220924 · Used in: 4937 components · Overview · Overview · Versions · Versions · Dependents · Dependents · Dependencies · Dependencies · JSON is a light-weight, language independent, data interchange format. See http://www.JSON.org/ The files in this package ...