You are missing json-simple-1.1.1.jar from your classpath.

if you are using Maven, add below into your pom.xml.

<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1.1</version>
</dependency>

Or you can download it from here.

Answer from Sundararaj Govindasamy on Stack Overflow
Discussions

java - JSONObject cannot be resolved to a type - Stack Overflow
I cannot import JSONObject, I thought this was something that came with java and an external jar is not needed, why is it saying it cannot find it? More on stackoverflow.com
🌐 stackoverflow.com
October 18, 2014
java - cannot import org.json.simple.JSONObject get error saying "org.jason cannot be resolved" - Stack Overflow
I'm trying to write a program that reads in a web service and phrasses it using the JSONObject object. I'm using eclipse when I try to import the library org.json.simple.JSONObject; I get a error More on stackoverflow.com
🌐 stackoverflow.com
April 11, 2018
java - JSONParser cannot be resolved to a type when I upgrade Json-path to 2.8 - Stack Overflow
I have a project, which is using jayway jsonpath com.jayway.jsonpath json-path ... More on stackoverflow.com
🌐 stackoverflow.com
August 1, 2023
java - Cannot resolve JSON dependency using Maven -- Object not found - Stack Overflow
I'm fairly new to Java (and especially to Maven) and am trying to compile a JavaFX application using the Google Firebase Admin SDK. I'm building using Maven in IntelliJ IDEA, and while my applica... More on stackoverflow.com
🌐 stackoverflow.com
January 1, 2018
🌐
Talend
community.talend.com › s › question › 0D55b000071oGDFCA2 › jsonobject-cannot-be-resolved-to-a-type
Home | Qlik Community
March 11, 2022 - Qlik Community is the global online community for Qlik employees, experts, customers, partners, developers and evangelists to collaborate.
🌐
Eclipse
bugs.eclipse.org › bugs › show_bug.cgi
539275 – Wrong error message when two Maven dependencies share packages under Java module system
Bugzilla – Bug 539275 Wrong error message when two Maven dependencies share packages under Java module system Last modified: 2023-07-06 03:26:45 EDT
🌐
Stack Overflow
stackoverflow.com › a › 51310557
java - Cannot resolve symbol getJSONObject with import org.json - Stack Overflow
Adding dependencies to your project will not add new methods to the existing classes available. Notably, adding dependency org.json will not add the method getJSONObject() to the class String.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 48047514 › cannot-resolve-json-dependency-using-maven-object-not-found
java - Cannot resolve JSON dependency using Maven -- Object not found - Stack Overflow
January 1, 2018 - Notes: I've tried building both with and without the JSON dependency in pom.xml. I'm not sure if I have the correct version or not, anyway. Additionally, I have tried moving the JSON file to the source code directory and redirecting the reference to the new location but to no avail. ... just use classloader to load your file like InputStream input= YourClassName.class.getClassLoader().getResourceAsStream(fileName) JSONObject jsonObject = new JSONObject(new JSONTokener(input));
🌐
Stack Overflow
stackoverflow.com › questions › 28311553 › conversion-to-maven-made-json-related-object-unresolved
java - Conversion to maven made json related object unresolved - Stack Overflow
February 4, 2015 - So I converted the project to maven (by going to Configure->Convert to Maven). Then I got JSONArray cannot be resolved to a type` on all my json object that worked before. ... Copy<dependencies> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20141113</version> </dependency> </dependencies>
🌐
Reddit
reddit.com › r/javahelp › can't import "json-20240303" library into my project.
r/javahelp on Reddit: Can't import "json-20240303" library into my project.
June 17, 2024 -

I'm going to start by saying I'm a complete novice in Java. I've started computer science recently and I've got a project where I have to create a project to represent a server using sockets. The server will has to function as a control a library's book record/register. My professor provided a .json file with the book lists which I have to use.

I tried creating the project on VS Code, but after following these steps:

Downloaded the library from the Maven Repository.

Created a lib folder in your project's root directory and move the json-20230303.jar file to this folder.

My code couldn't import the library and this error appeared every time I tried to use the library:

"src\Gerenciador.java:2: error: package org.json does not exist import org.json.JSONArray;"

After a while I thought it would be easier to import the library on the Ide Eclipse, but after creating the project and adding it via the Build Path option, it still didn't work. Even though the library appeared in the Libraries section in the Java Build Path.

This error: "The type org.json.JSONObject is not accessible" keeps appearing.

I don't know how to fix the problem. I think I'm calling on the library wrong, but I don't know how I should do it. If there is any information missing, let me know and I'll provide it, it's my first time asking for help on a programming forum.

Top answer
1 of 3
2
Show your pom.xml
2 of 3
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
Adobe Experience League
experienceleaguecommunities.adobe.com › home › product communities › adobe experience manager › adobe experience manager sites › org.json.simple -- cannot be resolved in bundle
org.json.simple -- Cannot be resolved in bundle | Community
May 13, 2016 - org.json.simple api wont be available in Felix so dependency cont be resolved. better use following one for json org.apache.sling.commons.json.JSONObject, its part of osgi. Like · Reply · kautuk_sahni · Adobe Employee · Forum|Forum|10 years ago · May 13, 2016 · Hi · Check this post:- Link:- http://stackoverflow.com/questions/31380082/cq5-osgi-bundle-error-org-json-simple-cannot-be-resolved · //Change your maven bundle configuration ·
🌐
Maven Repository
mvnrepository.com › artifact › org.json › json
Maven Repository: org.json » json
August 15, 2026 - 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.
🌐
Google Groups
groups.google.com › g › webdriver › c › kCppqtBB0g4
Unable to getHostName with JSONObject with webdriver 2.44
( I see them in my Maven dependencies of the project) and also webdriver 2.44.0 . I started the hub and node with 2.44.0 and confirmed it is 2.44.0 (Grid console confirms i am on 2.44.0) I did a mvn clean compile and it was successful. On test execution i see this error - (Not sure what else to do to resolve this error) java.lang.NoClassDefFoundError: com/google/common/net/MediaType ·
🌐
The Eclipse Foundation
eclipse.org › forums › index.php › t › 1103894
Eclipse Community Forums: Java Development Tools (JDT) » Eclipse not finding jar file | The Eclipse Foundation
The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 350 open source projects, including runtimes, tools and frameworks.
🌐
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