Error added: 2009-12-19 15:10
Stop trying to cast it to a JSONArray then! :)
this error appear when i cast it to a JSONObject :p, but it although i didn't use JSONArray ! toc!
It seems from the second example on this page http://code.google.com/p/json-simple/wiki/DecodingExamples that you are meant to be able to cast an JSONArray to an JSONObject:
String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
Object obj=parser.parse(s);
JSONArray array=(JSONArray)obj;
System.out.println(array.get(1));
JSONObject obj2=(JSONObject)array.get(1);
System.out.println(obj2.get("1"));
Or am I not reading it right here?
If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people struggling with this too.
There are 3 people waiting for the answer
If you want to be notified via email when this is solved, enter your email address here:
Hosted on a linuxvps.org Linux Virtual Private Server. Why not get your own?