0 votes
1 view
in Java by (3k points)

I have String variable called jsonString:


Now I want to convert it into JSON Object. I searched more on Google but didn't get any expected answers...

2 Answers

0 votes
by (32.7k points)

Try org.json library:

try {

     JSONObject jsonObject = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}");

}catch (JSONException err){

     Log.d("Error", err.toString());


0 votes
by (25.6k points)

You can also try this:

JSONParser parser = new JSONParser();

JSONObject json = (JSONObject) parser.parse(stringToParse);