Import Error Using JSON in Java

Question: How do I properly use and manipulate JSON in Java?

Background: Hey all, I am trying to manipulate a JSON file to store user data in a Java program. I have created a default JSON file with the default state of the save file and will have individual programs create copies of it which my save system will write/read to. I have gotten “package does not exist” errors when trying to use the json-simple-1.1.1.jar file. The exact errors differ based on what set of imports that I try.

Relevant Code Snippets

The Java File (ProgressLoader.java) imports I have tried:

//I first tried these imports
// import org.json.simple.JSONArray; 
// import org.json.simple.JSONObject; 
// import org.json.simple.parser.*; 

//Then, I tried these imports
// import json.simple.JSONAray;
// import json.simple.JSONObject;
// import json.simple.parser.JSONParser;

//Then, I tried these imports (and all of them failed, not just bc I didn't include JSONParser)
import org.json.JSONArray;
import org.json.JSONObject;

Uses of JSON scattered throughout ProgressLoader.java:

    File jsonFile = new File("userProgress.json");
    File defaultFile = new File("defaultUserProgress.json");
    defaultFile.copyTo(jsonFile);
    Object obj = new JSONParser().parse(new FileReader("userProgress.json"));  

    JSONObject userProgressJSON = (JSONObject) obj;
    JSONArray courses = (JSONArray) userProgressJSON.get("courses");

json-simple-1.1.1.jar is a file under target/dependency, is mentioned in pom.xml, and I tried manually adding it to the .classpath file. The first two were done automatically and the latter I did after suggestion by replit AI.

pom.xml dependency of json-simple-1.1.1.jar:

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

.classpath classentry of json-simple-1.1.1.jar:

  <classpathentry kind="lib" path="target/dependency/json-simple-1.1.1.jar"/>

Thank you in advance for any and all help, this is my first time using JSON files! Please let me know if you need any more details!

I can’t reproduce this problem with a skeletal repl: https://replit.com/@PhoenixStarlight/JsonImport#Main.java

The import should be org.json.simple.JSONArray

edit: If you can, you should use GSON instead.