Download the ZIP file from this URL and extract it to get the Jar. Add the Jar to your build path. To check the available classes in this Jar use this URL.

To Add this Jar to your build path Right click the Project > Build Path > Configure build path> Select Libraries tab > Click Add External Libraries > Select the Jar file Download

I hope this will solve your problem

Answer from Ramkumar Murugadoss on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 40856142 › cannot-import-jsonarray-into-jsp-in-eclipse › 40856157
java - cannot import jsonarray into jsp in eclipse - Stack Overflow
<%@ page import="java.utii.List" %> <%@ page import org.json.JSONArray %> <%@page import="java.util.ArrayList"%> <% List<String> exampleList = new ArrayList<>(); exampleList.add("Apple"); exampleList.add("Orange"); exampleList.add("Lemon"); JSONArray fruitList = new JSONArray(); fruitList.addAll(exampleList); %>
Discussions

eclipse - Add JSON Package Reference; new to Java - Stack Overflow
I'm brand new to Java and have always been a c kind-of-guy. That being said, I'm trying to use the JSON libraries (packages? classes? Java terminology is so damn confusing!) and am having issues ad... More on stackoverflow.com
🌐 stackoverflow.com
April 18, 2011
arrays - JSONObject not working in java eclipse - Stack Overflow
I am trying to create a JSONArray on java using eclipse as my IDE. However, I am unable to create a JSONArray object there is always a red line under JSONArray. Do i need to import anything because... More on stackoverflow.com
🌐 stackoverflow.com
July 22, 2017
import org.json.simple.JSONArray; how do I resolve this error? (java newbie)
an error keeps showing up? Try to be a bit more specific when asking for help. What is the error? More on reddit.com
🌐 r/javahelp
4
2
May 26, 2022
java - JSON parsing with Eclipse - Stack Overflow
You know the outermost element is an array so parse straight into a JSONArray. Next you want to pull out the first element of that array which is a JSONObject (its in braces). After that the code should be fairly self explanatory :) ... Have you imported java.io.File;? On that class in eclipse just ... More on stackoverflow.com
🌐 stackoverflow.com
May 22, 2017
🌐
Stack Overflow
stackoverflow.com › questions › 61621474 › how-to-import-json-simple-in-eclipse
java - How to import JSON Simple in Eclipse? - Stack Overflow
import org.json.simple.JSONObject; import org.json.simple.*; public class JSONSimple { @SuppressWarnings("unchecked") public static void writePlayers(Player[] players){ JSONObject obj = new JSONObject(); JSONArray playerList = new JSONArray(); JSONObject player; JSONArray scoreList; for(int i = 0; i < players.length; i++) { player = new JSONObject(); player.put("pseudo", players[i].getPseudo()); scoreList = new JSONArray(); for(int j = 0; j < players[i].getNextLevelToPass()-1; j++) { scoreList.add(players[j].getLevelScore(j)); } player.put("scoreList", scoreList); player.put("nextLevelToPass", players[i].getNextLevelToPass()); playerList.add(player); } obj.put("playerTab", playerList); System.out.println(obj); } } ... Ok so after some test, when you're in "Java Build Path/Libraries" you need to import the external libraries in "Classpath" not "Modulepath".
🌐
CodingTechRoom
codingtechroom.com › question › import-json-eclipse-java-project
How to Import JSON Library into an Eclipse Java Project - CodingTechRoom
Add the JAR file to your Eclipse project by right-clicking on your project > Build Path > Configure Build Path > Libraries > Add External JARs.
🌐
Eclipse
download.eclipse.org › rt › rap › doc › 2.2 › guide › reference › api › org › eclipse › rap › json › JsonArray.html
JsonArray (Eclipse Remote Application Platform API Reference)
Note that this class is not thread-safe. If multiple threads access a JsonArray instance concurrently, while at least one of these threads modifies the contents of this array, access to the instance must be synchronized externally.
Find elsewhere
🌐
Reddit
reddit.com › r/javahelp › import org.json.simple.jsonarray; how do i resolve this error? (java newbie)
r/javahelp on Reddit: import org.json.simple.JSONArray; how do I resolve this error? (java newbie)
May 26, 2022 -

I have tried downloading this and adding it to my project on eclipse as an external file yet an error keeps showing up?

http://www.java2s.com/Code/Jar/j/Downloadjavajsonjar.htm

Top answer
1 of 4
3
an error keeps showing up? Try to be a bit more specific when asking for help. What is the error?
2 of 4
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.
🌐
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.
🌐
YouTube
youtube.com › watch
how to import path in java eclipse || how to create json in java using eclipse || import path - YouTube
json jar file download link https://jar-download.com/artifacts/org.jsonlive server hosting 👉 https://youtu.be/JtVYj8Ue7AQSwitch case in java 👉 https:/
Published: August 21, 2021
🌐
TutorialsPoint
tutorialspoint.com › org_json › org_json_quick_guide.htm
Org.Json - Quick Guide
A JSONArray class object is an ordered sequence of values. It provides methods to access values by index and to put values. Following types are supported − ... package com.tutorialspoint; import org.json.JSONArray; public class JsonDemo { public static void main(String[] args) { JSONArray list = new JSONArray(); list.put("Apple"); list.put("Banana"); list.put("Orange"); list.put("Mango"); list.put("Guava"); System.out.println("JSONArray: "); System.out.println(list); } }
🌐
Jar-Download
jar-download.com › home › org.json
Download org.json JAR files with all dependencies
This is a reference implementation. There are a large number of JSON packages in Java. Perhaps someday the Java community will standardize on one.
🌐
Qastack
qastack.mx › programming › 8997598 › importing-json-into-an-eclipse-project
Importar JSON a un proyecto de Eclipse
import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Iterator; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException;
Top answer
1 of 1
7

The question is a bit unclear, so my answer is equally general...

In order to use a third-party library in Java (like JSON-lib in your case), the library must be present during compilation and during execution (runtime) of your program. This is done by downloading the .jar file and telling Java where to find it. Java uses the concept of classpath:

Classpath is a parameter – set either on the command-line, or through an environment variable – that tells the Java Virtual Machine or the compiler where to look for user-defined classes and packages.

(from Wikipedia)

The error you mention ("Import org.json.JSONObject cannot be resolved") means that the .jar wasn't on the classpath during compilation.

To add a third-party library in Eclipse, store the .jar file somewhere in your project (a dedicated lib folder would be a good choice), then right-click on your project, choose Properties → Java Build Path → Libraries, click "Add JARs..." and choose your .jar file. From now on, Eclipse will add it to the classpath during compilation.

Adding it to the classpath during execution depends on the kind of project you're running. If you have a simple main method which you're running from Eclipse, the .jar will be automatically added to the classpath. If you're running a web application in a container such as Tomcat, JBoss etc., then the standard way to add the .jar to the classpath would be to put it in the WEB-INF/lib directory of your deployed application. Have a look at the Java EE tutorial for more information on web applications and their deployment.