Reputation: 75
I need to parse a JSON string in my project, which runs on BB OS 5. OS version 5 does not have JSON parsing inbuilt in it. I have tried the code from the Knowledge Base article Sample Code - Implementing JSON in your application, but it does not run on OS 5 either.
Can someone suggest a library or some jar file to parse JSON for BB OS 5.
Upvotes: 0
Views: 823
Reputation: 75
Hey thanks Signare for your help. The jar dint work for me but importing the source files did. :) Initially I had imported the source files, but along with that I forgot to remove the BB json imports. Now it works fine... on all OS versions.
Got the source files from here https://bitbucket.org/liedman/json-me/src/501a54188df3/src/org/json/me
Upvotes: 1
Reputation: 4158
This will help you - Json
String jsonStr = "{\"team\":\"india\",\"manager\":\"meSağlam\",\"year\":\"2012\"}";
Create a JSONObject:
JSONObject obj = new JSONObject(jsonStr);
if you want to use the value of the "team" field which is "Bursaspor" then you should use your JSONObject like this:
obj.getString("team");
This call will return the string value which is "india".
Upvotes: 2