If you download the JSON jar specified, and list its contents (e.g. with jar tf), it does not contain the org.json.simple package.

So the problem is simply that you need another jar.

EDIT:

I don't know if this is the intent, but an educated guess: if you add this dependency to build.gradle:

compile 'com.googlecode.json-simple:json-simple:1.1.1'

and these imports:

import org.json.simple.parser.*;
// import org.json.simple.*;
import org.json.*;

then the example compiles (for me).

Answer from Michael Easter 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 ...
Discussions

Import org.json:json as gradle dependency
Hi, I couldn’t expect this would become as difficult. I am trying to import org.json:json to be used inside my beans. Have tried many things in my build.gradle file, among others: compileClasspath( group: ‘org.json’, name: ‘json’, version: ‘20201115’ ) and implementation ... More on forum.jmix.io
🌐 forum.jmix.io
0
0
December 27, 2021
Unable to add Json Dependency in build.gradle
Hi. I added this line: compile group: ‘org.json’, name: ‘json’, version: ‘20180813’ in the dependency section of build.gradle but I get an error and I have looked everywhere online. I even talked to Jason on 2073 who was also confused. Error: > Could not resolve all files for ... More on chiefdelphi.com
🌐 chiefdelphi.com
0
0
June 18, 2018
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
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
🌐
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.
🌐
Jmix
forum.jmix.io › support
Import org.json:json as gradle dependency - Support - Jmix
December 27, 2021 - Hi, I couldn’t expect this would become as difficult. I am trying to import org.json:json to be used inside my beans. Have tried many things in my build.gradle file, among others: compileClasspath( group: ‘org.json’, name: ‘json’, version: ‘20201115’ ) and implementation ...
🌐
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
🌐
Chief Delphi
chiefdelphi.com › technical › java
Unable to add Json Dependency in build.gradle - Java - Chief Delphi
June 18, 2018 - Dont add it to build.gradle Download the jar and put it in USER/wpilib/user/java/lib/json.jar it will compile. I would not recommend following this advice - adding to build.gradle allows you to more easily update dependencies when needed and automatically download them when first setting up a project on a new computer.
🌐
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 · Gradle ·
Find elsewhere
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json › 20090211
Maven Repository: org.json » json » 20090211
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 ...
🌐
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 › json-simple
Maven Repository: org.json » json-simple
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 logging maven mobile module npm osgi plugin resources rlang sdk server service spring ...
🌐
Sourcecodeexamples
sourcecodeexamples.net › 2019 › 12 › json-simple-maven-dependency.html
json-simple maven dependency
December 3, 2019 - Copy below JSON.simple Gradle dependency and paste in your project build.gradle file: // https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' https://repo1.maven.org/maven2/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar ·
🌐
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:
🌐
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.
🌐
Maven Central Repository
search.maven.org › artifact › com.googlecode.json-simple › json-simple › 1.1.1 › bundle
Maven Central Repository Search
pkg:maven/com.googlecode.json-simple/json-simple@1.1.1 · Used in: components · Overview · Overview · Versions · Versions · Dependents · Dependents · Dependencies ·
🌐
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

🌐
Jar-Download
jar-download.com › home › com.googlecode.json-simple › json-simple › 1.1.1 › source code › jsonparser.java
org.json.simple.parser.JSONParser Maven / Gradle / Ivy
Maven · Gradle · Ivy · SBT · /* * $Id: JSONParser.java,v 1.1 2006/04/15 14:10:48 platform Exp $ * Created on 2006-4-15 */ package org.json.simple.parser; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.json.simple.JSONArray; import org.json.simple.JSONObject; /** * Parser for JSON text.
🌐
Maven Repository
mvnrepository.com › artifact › com.googlecode.json-simple › json-simple › 1.1.1
Maven Repository: com.googlecode.json-simple » json-simple » 1.1.1
March 21, 2012 - #60in JSON Libraries · Vulnerabilities · Vulnerabilities from dependencies: CVE-2020-15250 · Maven · Gradle · SBT · Mill · Ivy · Grape · Leiningen · Buildr · Scope: Compile · Test · Provided · Runtime · Include backlinks · Scope: Compile · Test · Provided ·
Published   Mar 21, 2012
Version   1.1.1
🌐
Github-wiki-see
github-wiki-see.page › m › RameshMF › java-json-processing-tutorial › wiki › JSON.simple-Maven-Dependency
JSON.simple Maven Dependency - RameshMF/java-json-processing-tutorial GitHub Wiki
Copy below JSON.simple gradle dependency and paste in your project build.gradle file: // https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' https://repo1.maven.org/maven2/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar ·