It seems like you are missing a dependency json-simple.

1) Here is the link JSON.simple » 1.1.1 where you can download missing dependency.

2) Add downloaded dependency

3) If you have the maven or gradle project then copy dependencies line.

4) Then clean build the project and see the magic.

Answer from Dushyant Tankariya on Stack Overflow
Top answer
1 of 1
11

The JSONParser class is lower down on the tutorial it looks like this...

public class JSONParser {

    static InputStream is = null;
    static JSONObject jObj = null;
    static String json = "";

    // constructor
    public JSONParser() {

    }

    // function get json from url
    // by making HTTP POST or GET method
    public JSONObject makeHttpRequest(String url, String method,
            List<NameValuePair> params) {

        // Making HTTP request
        try {

            // check for request method
            if(method == "POST"){
                // request method is POST
                // defaultHttpClient
                DefaultHttpClient httpClient = new DefaultHttpClient();
                HttpPost httpPost = new HttpPost(url);
                httpPost.setEntity(new UrlEncodedFormEntity(params));

                HttpResponse httpResponse = httpClient.execute(httpPost);
                HttpEntity httpEntity = httpResponse.getEntity();
                is = httpEntity.getContent();

            }else if(method == "GET"){
                // request method is GET
                DefaultHttpClient httpClient = new DefaultHttpClient();
                String paramString = URLEncodedUtils.format(params, "utf-8");
                url += "?" + paramString;
                HttpGet httpGet = new HttpGet(url);

                HttpResponse httpResponse = httpClient.execute(httpGet);
                HttpEntity httpEntity = httpResponse.getEntity();
                is = httpEntity.getContent();
            }           

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    is, "iso-8859-1"), 8);
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
            is.close();
            json = sb.toString();
        } catch (Exception e) {
            Log.e("Buffer Error", "Error converting result " + e.toString());
        }

        // try parse the string to a JSON object
        try {
            jObj = new JSONObject(json);
        } catch (JSONException e) {
            Log.e("JSON Parser", "Error parsing data " + e.toString());
        }

        // return JSON String
        return jObj;

    }
}

I would consider looking at the jackson library tho http://jackson.codehaus.org/

🌐
CopyProgramming
copyprogramming.com › howto › constructor-jsonparser-in-class-jsonparser-cannot-be-applied-to-given-types-error-occured
JSONParser Cannot Be Resolved to a Type: Complete Solution Guide for 2026 - Jsonparser cannot be resolved to a type
October 19, 2025 - ... The "JSONParser cannot be resolved ... with JSON data. This error occurs when your IDE or compiler cannot find the JSONParser class because the necessary library dependency is missing from your project or because the wrong import statement is being used....
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 40596301 › im-trying-to-read-a-json-file-but-compiler-says-parser-cannot-be-resolved-jav
I'm trying to read a json file, but compiler says, Parser cannot be resolved JAVA - Stack Overflow
November 15, 2016 - Did you consider creating a ContainerFactory() for the parser? http://juliusdavies.ca/json-simple-1.1.1-javadocs/org/json/simple/parser/ContainerFactory.html · Also, your "comment.json" is just a JSONObject(), so no need in giving in the extra overhead of JSONArray() ... ContainerFactory cf = new ContainerFactory(); Map jsonContainer = cf.createObjectContainer(); JSONParser parser = new JSONParser(); JSONObject jObj = (JSONObject) parser.parse(new FileReader("comments.json"), jsonContainer);
🌐
The Coding Forums
thecodingforums.com › archive › archive › java
JSONArray cannot be resolved to a type | Java | Coding Forums
November 18, 2008 - Not knowing the layout of your web app, it's hard to be sure, but the usual layout is: webapps/APPNAME/ <= html, JSP and such webapps/APPNAME/WEB-INF/ <= hidden resources start here webapps/APPNAME/WEB-INF/classes/ <= root of all compiled Java webapps/APPNAME/WEB-INF/lib/ <= JARs go here · JSONArray cannot be resolved to a type 47: 48: public String getNumOp() 49: { 50: JSONArray jsonArray = new JSONArray(); 51: for(int i=0;i<6;i++) 52: { 53: jsonArray.put(numOperators); How come?
🌐
CopyProgramming
copyprogramming.com › howto › jsonproperty-cannot-be-resolved-to-a-type
Java: Unresolved Type Error for Jsonproperty
May 27, 2023 - It might be worth checking out the jackson library at http://jackson.codehaus.org/. As for solutions, you have two options. First, you can utilize the generic type T.
🌐
CopyProgramming
copyprogramming.com › howto › cannot-resolve-symbol-getjsonobject-with-import-org-json
Java: Importing org.json does not resolve symbol getJSONObject
May 8, 2023 - If you encounter an error such as "The constructor JSONParser() is deprecated" while attempting to retrieve data from your JSON file, it is likely due to incorrect usage. To assist you, I have provided a sample code below that may help you understand how to properly retrieve your data. import ...
🌐
YouTube
youtube.com › hey delphi
Android : JSONParser cannot be resolved to a type - YouTube
Android : JSONParser cannot be resolved to a typeTo Access My Live Chat Page, On Google, Search for "hows tech developer connect"Here's a secret feature that...
Published   May 26, 2023
Views   5
🌐
Amazonaws
fevapo5jgge9zyfq.s3.amazonaws.com › method-cannot-be-resolved-to-a-type.html
Method Cannot Be Resolved To A Type - Matthew Carrasco blog
July 19, 2021 - Gson cannot be resolved to a type eclipse you can deploy by both of these option. The solution is to use e as the value for t. Method cannot be resolved javaminnie mouse blanket for baby girl posted by : Popular extensions for java development ...
🌐
Google Groups
groups.google.com › d › topic › jbpm-usage › B62P8Wt8GMo
Import in JBPM Script Task
April 27, 2015 - on process level in web designer when you open properties panel (right hand side) you will find imports section where you can add any java like imports that will be propagated into script tasks.
🌐
Talend
community.talend.com › s › question › 0D55b000071oGDFCA2 › jsonobject-cannot-be-resolved-to-a-type
JSONObject cannot be resolved to a type
March 11, 2022 - Before we had the "final" apps in streams, when we wanted to work on an already published app, we made 2 duplicates from the published app, one was moved into the archive stream, and we worked with the other one.
🌐
Talend
community.talend.com › s › feed › 0D53p00007vCk2bCAC
import org.json.
October 9, 2015 - Loading · ×Sorry to interrupt · Refresh
🌐
The Eclipse Foundation
eclipse.org › forums › index.php › t › 1090676
Eclipse Community Forums: Newcomers » "Cannot be resolved to a type" error | The Eclipse Foundation
December 18, 2017 - The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 350 open source projects, including runtimes, tools and frameworks.
🌐
Try2explore
try2explore.com › questions › 12351195
java - Jsonparser cannot resolve to type
But Eclipse gives me the JSONParser cannot be resolved to a type.