Every time you use a jsonobject data, you always throw an exception, so that you can see quite irritable.
I'm not so fond of throwing exceptions every time go try Cahch
Public map<string,object> parsetomap (jsonobject obj) {map<string,object> Map = new hashmap<string, Object> (); Try{for (iterator<?> Iterator = Obj.keys (); Iterator.hasnext ();) {String key = Transformutils.tostring (Iterator.next ()); Object data = Obj.get (key); if (data instanceof Jsonarray) {map.put (Key, Parsetomaps ((jsonarray) data));} Else{map.put (Key, transformutils.tostring (data));}}} catch (Exception e) {}return map; }public list<map<string,object>> parsetomaps (jsonarray jsonarray) {list<map<string,object> > maps = new vector<map<string,object>> (); try {int length = Jsonarray.length (); for (int x=0;x<length;x + +) {Object data = Jsonarray.get (x), if (data instanceof Jsonobject) {Maps.add (Parsetomap ((jsonobject) data));}}} CA TCH (Exception e) {}return maps; }
Java better parse JSON data