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
🌐
Oracle
docs.oracle.com › javaee › 7 › api › javax › json › JsonArray.html
JsonArray (Java(TM) EE 7 Specification APIs)
JsonArray represents an immutable JSON array (an ordered sequence of zero or more values).
🌐
TutorialsPoint
tutorialspoint.com › org_json › org_json_jsonarray.htm
Org.Json - HTTP Class
JSONArray: ["Apple","Banana","Orange","Mango","Guava"] package com.tutorialspoint; import org.json.JSONArray; public class JsonDemo { public static void main(String[] args) { JSONArray list = new JSONArray(); list.put(Integer.valueOf(100)); list.put(Integer.valueOf(200)); list.put(Integer.valueOf(300)); list.put(Integer.valueOf(400)); list.put(Integer.valueOf(500)); System.out.println("JSONArray: "); System.out.println(list); } }
Discussions

java - Importing JSON into an Eclipse project - Stack Overflow
I'm an aspiring Java programmer looking to use JSON in a project. I was following a programming tutorial (from a book) which asked me to import JSON into my project by using the following line: im... More on stackoverflow.com
🌐 stackoverflow.com
java - How to import JSONArray to ArrayList<>? - Stack Overflow
You can't just "import" json data, but you can parse it: stackoverflow.com/questions/2591098/how-to-parse-json-in-java More on stackoverflow.com
🌐 stackoverflow.com
December 3, 2014
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
json - How to access JSONArray in a JSONObject using Java? - Stack Overflow
I am having a problem in accessing the JSONArray ("pages") while reading a json file in Java using the json-simple-1.1.1.jar My json file is around 32MB of size and the format is as below: { ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › stleary › JSON-java › blob › master › src › main › java › org › json › JSONArray.java
JSON-java/src/main/java/org/json/JSONArray.java at master · stleary/JSON-java
import java.util.Map; · · /** * A JSONArray is an ordered sequence of values. Its external text form is a · * string wrapped in square brackets with commas separating the values. The · * internal form is an object having <code>get</code> and <code>opt</code> * methods for accessing the values by index, and <code>put</code> methods for ·
Author: stleary
🌐
Stleary
stleary.github.io › JSON-java › org › json › JSONArray.html
JSONArray
The internal form is an object having get and opt methods for accessing the values by index, and put methods for adding or replacing values. The values can be any of these types: Boolean, JSONArray, JSONObject, Number, String, or the JSONObject.NULL object. The constructor can convert a JSON text into a Java object.
🌐
GeeksforGeeks
geeksforgeeks.org › java › what-is-json-java-org-json
What is JSON-Java (org.json)? - GeeksforGeeks
July 17, 2022 - Let us see how the JSONObject and JSONArray can be written in an external file named "author.json" via ... // importing java simple libraries and JSON libraries import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.LinkedHashMap; import java.util.Map; import org.json.simple.JSONArray; import org.json.simple.JSONObject; public class JSONWriteExample { public static void main(String[] args) throws FileNotFoundException { // Json object is created JSONObject jsonObject = new JSONObject(); // Adding data using the created object jsonObject.put("firstName", "Rachel"); j
🌐
Javadoc.io
javadoc.io › doc › org.json › json › 20171018 › org › json › JSONArray.html
JSONArray (JSON in Java 20171018 API)
https://javadoc.io/doc/org.json/json · Current version 20171018 · https://javadoc.io/doc/org.json/json/20171018 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/org.json/json/20171018/package-list · Manage versions · https://javadoc.io/versions/org.json/json ·
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 27266675 › how-to-import-jsonarray-to-arraylist
java - How to import JSONArray to ArrayList<>? - Stack Overflow
December 3, 2014 - You can't just "import" json data, but you can parse it: stackoverflow.com/questions/2591098/how-to-parse-json-in-java · Anton Kolyaev – Anton Kolyaev · 2014-12-03 08:46:10 +00:00 Commented Dec 3, 2014 at 8:46 · Add a comment | Related questions · 3 · JSONObject to ArrayList? 1 · Putting a JSONArray into a list(Android) 3 ·
🌐
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.
🌐
Android Developers
developer.android.com › api reference › jsonarray
JSONArray | API reference | Android Developers
August 3, 2026 - Skip to main content · English · Deutsch · Español – América Latina · Français · Indonesia · Polski · Português – Brasil · Tiếng Việt · 中文 – 简体
🌐
Crunchify
crunchify.com › json tutorials › how to parse jsonobject and jsonarrays in java? beginner’s guide
How to Parse JSONObject and JSONArrays in Java? Beginner's Guide • Crunchify
February 2, 2023 - package crunchify.com.java.tutorials; import org.json.JSONArray; import org.json.JSONObject; /** * @author Crunchify.com * Program: How to Parse JSONObject and JSONArrays in Java?
🌐
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); } }
🌐
TutorialsPoint
tutorialspoint.com › how-to-read-parse-json-array-using-java
How to read/parse JSON array using Java?
May 5, 2025 - Iterator<String> iterator = jsonArray.iterator(); while(iterator.hasNext()) { System.out.println(iterator.next()); } Below is an example of a Java program that parses the above-created sample.json file, reads its contents, and displays them. 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; public class ReadingArrayFromJSON { public static void main(String args[]) { //Cr
Top answer
1 of 3
3

With the below code it is working perfect for me. Can you check whether the specified file location is correct? Also try reading id like pagesObject.get("id")

package json.simple;

import java.io.FileReader;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;

public class ReadJSON {
    public static void main(String[] args) throws Exception {
        JSONParser parser = new JSONParser();
        JSONObject pagesObject = (JSONObject) parser.parse(new FileReader("/home/user/tmp/test.json"));
        System.out.println(pagesObject.get("id"));
        System.out.println(pagesObject.get("pages").getClass().getName());
        JSONArray jsonArray= (JSONArray) pagesObject.get("pages");

        for(int i=0; i<jsonArray.size(); i++){
            System.out.println(jsonArray.get(i));
        }
    }
}

And here is the content of my test.json. Exactly same as yours

{
    "id": "0912898213",
    "pages": [
        {
            "pageUrl": "http://www.example0.com",
            "results": [
                {
                    "number": "1"
                },
                {
                    "number": "2"
                }
            ]
        },
        {
            "pageUrl": "http://www.example1.com",
            "results": [
                {
                    "number": "3"
                },
                {
                    "number": "4"
                }
            ]
        }
    ]
}

And here is my dependency in maven

<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1.1</version>
</dependency>
2 of 3
1

Finally its working now, but I still do not know the actual cause of the problem. I partitioned the file into two separate json files, and executed the code on both of them and it worked. Now I just have to merge them and its done! Not a good solution but couldn't find another way!

🌐
Linus Tech Tips
linustechtips.com › software › programming
How to import JSON simple package into Java? (Only using VSCode, not Maven/other IDEs) - Programming - Linus Tech Tips
September 3, 2022 - I need it so that the import code works and I can actually use it in my project. JSON jar image: Import code: import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.js...
🌐
SourceForge
json-lib.sourceforge.net › apidocs › net › sf › json › JSONArray.html
JSONArray (Overview (json-lib jdk 1.3 API))
The internal form is an object having get and opt methods for accessing the values by index, and element methods for adding or replacing values. The values can be any of these types: Boolean, JSONArray, JSONObject, Number, String, or the JSONNull object. The constructor can convert a JSON text into a Java object.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-convert-json-array-to-string-array-in-java
How to Convert JSON Array to String Array in Java? - GeeksforGeeks
July 23, 2025 - // importing the packages import java.util.*; import org.json.*; public class GFG { public static void main(String[] args) { // Initialising a JSON example array JSONArray exampleArray = new JSONArray(); // Entering the data into the array ...
🌐
TutorialsPoint
tutorialspoint.com › how-to-write-create-a-json-array-using-java
How to Write/create a JSON array using Java?
JSONArray array = new JSONArray(); array.add("element_1"); array.add("element_2"); array.add("element_3"); After adding all the required elements add the array into the JSON document using the put() method as ?
🌐
Intellipaat
intellipaat.com › home › blog › how to create a correct jsonarray in java using jsonobject?
How to Create a Correct JSONArray in Java Using JSONObject?
May 27, 2025 - To work with JSON in Java, include the org.json library either in your Maven or Gradle project. <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20210307</version> </dependency> implementation 'org.json:json:20210307' import org.json.JSONArray; import org.json.JSONObject; Create JSONObjects to represent key-value pairs.