In my case i was using maven build tool and got this error so had to add below dependency from here like below and error resolved.

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20180130</version>
</dependency>
Answer from Alien on Stack Overflow
Discussions

error: package org.json does not exist

Currently, org.json.jar sits in the same path

Java expects packages to be in a folder structure.

More on reddit.com
🌐 r/learnjava
3
4
May 4, 2019
java - Cannot resolve json import Intellij after adding dependency and library .jar - Stack Overflow
I cannot seem to resolve this issue after adding the json-lib-2.4-jdk15.jar from an online source to the project dependencies, screenshots provided to show walkthrough of what I am doing. (and yes ... More on stackoverflow.com
🌐 stackoverflow.com
package does not exist
There was an error while loading. Please reload this page · I am new to Ijava in jupyter More on github.com
🌐 github.com
1
May 14, 2020
Can't import "json-20240303" library into my project.
Show your pom.xml More on reddit.com
🌐 r/javahelp
7
2
June 17, 2024
🌐
Coderanch
coderanch.com › t › 666886 › java › package-org-json-exist
package org.json does not exist [Solved] (Beginning Java forum at Coderanch)
Here are some details: $ echo $CLASSPATH /usr/share/java $ ll /usr/share/java/json* -rw-r--r-- 1 root root 49176 Jun 12 22:31 /usr/share/java/json-20160212.jar $ jar tf /usr/share/java/json-20160212.jar META-INF/MANIFEST.MF META-INF/ META-INF/maven/ META-INF/maven/org.json/ META-INF/maven/org.json/json/ META-INF/maven/org.json/json/pom.properties META-INF/maven/org.json/json/pom.xml org/ org/json/ org/json/CDL.class org/json/Cookie.class org/json/CookieList.class org/json/HTTP.class org/json/HTTPTokener.class org/json/JSONArray.class org/json/JSONException.class org/json/JSONML.class org/json/
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 6135911711634-Package-org-json-simple-x-Does-not-Exist
Package org.json.simple.x Does not Exist – IDEs Support (IntelliJ Platform) | JetBrains
When i Attempt to Build My Project i get 'package org.json.simple does not exist' as an Error, In the Normal View it does not mark any errors, only When Building, Help would be appreciated!
🌐
Reddit
reddit.com › r/learnjava › error: package org.json does not exist
r/learnjava on Reddit: error: package org.json does not exist
May 4, 2019 -

I'm parsing json files using JSONArray and JSONObject but I keep getting the error shown in the title. I've downloaded org.json.jar but I don't know what to do next. Currently, org.json.jar sits in the same path as all of the other java files and classes.

Thanks!

Find elsewhere
🌐
GitHub
github.com › SpencerPark › IJava › issues › 106
package does not exist · Issue #106 · SpencerPark/IJava
May 14, 2020 - | import org.json.JSONArray; package org.json does not exist · So how to solve this · No one assigned · No labels · No labels · No projects · No milestone · None yet · No branches or pull requests ·
Author   sant527
🌐
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.
🌐
CopyProgramming
copyprogramming.com › howto › package-org-json-does-not-exist-when-importing-org-json-jsonobject
Java: Importing org.json.JSONObject results in 'Package org.json does not exist' error
April 24, 2023 - But when I compile the project from console by play clean compile, play gives me the error: package org.json does not exist [error] import org.json.JSONArray. json.jar is … ... java packages live on a linux system package orgjson package orgjson does not exist force intellij idea to reread all maven dependencies
🌐
Reddit
reddit.com › r/javahelp › error: org.json does not exist
r/javahelp on Reddit: Error: org.json does not exist
April 18, 2022 -

I have been trying to figure out this issue forever now but I can't seem to see what I'm doing wrong. I am using VSCode and added the json library (json-20220329.jar) to my referenced libraries. When I add the jar file the errors in my main file go away regarding JSONObject and JSONArray. Everything looks fine until I try running the code and it says that the "package org.json does not exist." I was wondering if anyone knew what could be the problem.

CODE: (App.java)

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;



import org.json.JSONObject;
import org.json.JSONArray;




public class App {
    public static void main(String[] args) {

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder().uri(URI.create("https://jsonplaceholder.typicode.com/albums")).build();
        client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
            .thenApply(HttpResponse::body)
            .thenAccept(System.out::println)
            .join();
    }

    public static String parse(String responseBody) {
        JSONArray albums = new JSONArray(responseBody);
        for (int i = 0; i < albums.length(); i++)
        {
            JSONObject album = albums.getJSONObject(i);
            int id = album.getInt("id");
            int userID = album.getInt("userId");
            String title = album.getString("title");
            System.out.println(id + "\t" + title + "\t" + userID);
        }
        return null;
    }
    
}

ERROR:

App.java:8: error: package org.json does not exist
import org.json.JSONObject;
               ^
App.java:9: error: package org.json does not exist
import org.json.JSONArray;
               ^
App.java:26: error: cannot find symbol
        JSONArray albums = new JSONArray(responseBody);
        ^
  symbol:   class JSONArray
  location: class App
App.java:26: error: cannot find symbol
        JSONArray albums = new JSONArray(responseBody);
                               ^
  symbol:   class JSONArray
  location: class App
App.java:29: error: cannot find symbol
            JSONObject album = albums.getJSONObject(i);
            ^
  symbol:   class JSONObject
  location: class App
5 errors
Top answer
1 of 2
4
I'm not used to VSCode but evidently the library is used to compile but not at runtime. Perhaps you have to add it somewhere else, maybe in the run configuration? PS if you want to keep your sanity while developing in java, i strongly suggest to use maven to automate dependencies (unless this is homework then maybe not).
2 of 2
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://imgur.com/a/fgoFFis ) 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.
🌐
Google Groups
groups.google.com › g › j2objc-discuss › c › O-t4wGix9J8
Parser.java:3: package org.json does not exist
December 10, 2020 - That's correct. The org.json API is not part of the Java Runtime, and so developers shouldn't expect it to be on the bootclasspath.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 21479962703890-JSON-plugin-dependency-cannot-be-resolved
JSON plugin dependency cannot be resolved? – IDEs Support (IntelliJ Platform) | JetBrains
September 19, 2024 - Org Competency R&D Hybris Idea Plugin · Created October 21, 2024 06:17 · Hi Karol Lewandowski , we have a similar issue with the next plugin version (2024.3.0). Plugin page Compatibility verification shows the following result: 2 compatibility problems: Package 'com.intellij.json' is not found (1 problem) Package 'com.jetbrains.jsonSchema' is not found (1 problem) The plugin was added as a dependency (build.gradle.kts): plugin("com.intellij.modules.json:243.19420.21") Due to this issue, the new version isn't published, the plugin itself is working in runtime.
🌐
Reddit
reddit.com › r/learnprogramming › "error: package org.json.simple does not exist" why?
r/learnprogramming on Reddit: "error: package org.json.simple does not exist" Why?
November 1, 2022 -

Trying to use JSON to store some objects locally for retrieval later. Can't figure out why I'm unable to import json. Doesn't work in vim, doesn't work in vsCode, doesn't work in Eclipse.

Read online that I may need to download the json .jar and add to my build path? When googling "json download" its only scammy virus websites.

I'm on a Mac.

Edit: Added pictures

https://imgur.com/a/FlKwMIF

Thanks for the help.

🌐
Stack Overflow
stackoverflow.com › questions › 60688907 › org-jose4j-json-internal-json-simple-can-not-be-found
java - org.jose4j.json.internal.json_simple can not be found - Stack Overflow
Are there any reasons why it worked at a simple java program and it does not work at the android project? ... It's likely you are using different jars or different code. If you share your projects, I'll tell you what exactly the problem is.