Error while Parsing JSON in developing extension

I am getting these errors while parsing JSON.

[javac]                                 ^
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/shivamblog100/AttachmentUrl/ error: cannot find symbol
[javac]         JSONObject jsn = JSONObject(response);
[javac]                          ^
[javac]   symbol:   method JSONObject(String)
[javac]   location: class AttachmentUrl
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.

These are my imports to parse JSON:

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

Kindly help me in fixing these errors. Thank you. :slight_smile:

It seems you are trying to develop an extension with the app inventor sources. It is best to ask for help in the open source development category of the App Inventor community.

1 Like

Yeah, I am using Appy Builder editor because Kodular editor is not working. Also, my PC is not working properly nowadays, so I am doing it on my mobile. Is it wrong to ask these errors here?

Since you are using a Kodular product i will list your question again.

1 Like

Thank you for your response. :relieved: :slight_smile:

The JSONObject(String) is a constructer, however, you are using it in your code as a method as the error implies, you might try to use the new statement before the constructor to indicate that you are constructing a new JSONObject class instance, as in this example:

JSONObject jsn = new JSONObject(response);

Thanks. It solved my error. :relieved:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.