I am a fresher in java and jsp and I am using json. I have imported json library in my jsp page. <%@ page import ="net.sf.json.JSONArray" %>
. but when I am creating the object of net.sf.json.JSONArray array=new net.sf.json.JSONArray();
an error is thrown. I don't know what is wrong. please help me.
I have also tried JSONArray array=new JSONArray()
but this is also not working. I am stuck here. plz plz help me.
Asked
Active
Viewed 88 times
0

Varun
- 4,342
- 19
- 84
- 119
-
Provide your json string. Your json string might have errors – Pasupathi Rajamanickam Apr 20 '15 at 10:00
-
@Pasupathi sorry to being so dumb but i am totally new in json. can u make it more clear please – Varun Apr 20 '15 at 10:01
-
@varun, but can you be more clearer? what error are you getting? – Alexandru Severin Apr 20 '15 at 10:03
-
If I understand your question correctly, If you have a Json String then you can create JsonObject or JsonArray. You can refer this http://www.tutorialspoint.com/json/json_java_example.htm – Pasupathi Rajamanickam Apr 20 '15 at 10:05
-
1Possible duplicate: http://stackoverflow.com/questions/1858463/java-error-only-a-type-can-be-imported-xyz-resolves-to-a-package, the error message is misleading. – Christophe Roussy Apr 20 '15 at 10:09
-
1possible duplicate of [Error I got while trying to make json work in a jsp page . How to debug this?](http://stackoverflow.com/questions/4314976/error-i-got-while-trying-to-make-json-work-in-a-jsp-page-how-to-debug-this) – singhakash Apr 20 '15 at 10:10
-
@singhakash the question you are talking about I have already checked it .the jar file I have downloaded have this class- net/sf/json/JSONArray.class. Still I am getting the error. – Varun Apr 20 '15 at 10:20
-
@varun what IDE you are using try clean and build – singhakash Apr 20 '15 at 10:24
-
@ singhakash eclipse . cleaned and build, still same problem bro – Varun Apr 20 '15 at 10:31