09-24-2009 02:40 AM - edited 09-24-2009 02:42 AM
Hi, I want to parse the response coming from the server in JSON format.
I have done some googling but i can't find any library or jar kind of thing. Everywhere there is provided open source code as zip file.
How can i achive this?..& if there is no any jar available for blackberry then how to use that open source code in my application??
I have used 1 jar file org.json, but it gives me the exception "module not found".
Thanks in advance.
Solved! Go to Solution.
09-24-2009 05:57 AM
download the zip folder of package org.json.me and import it in your project...
then use it like..
JSONObject outer=new JSONObject(resp); // resp is JSON response i am getting
JSONArray ja = outer.getJSONArray("DATA");
JSONArray arr=ja.getJSONArray(0); // for accessing each element of JSON Array.
if the response contains JSON Array...A JSON Array will be of the form..
"DATA":[ "abc" , "def"] // DATA isarray name and "abc " and "def" are array elements...