I am working on an Android application. In my app I have to convert a string to Json Object, then parse the values. I checked for a solution in stackoverflow and found simil
May be below is better.
JSONObject jsonObject=null; try { jsonObject=new JSONObject(); jsonObject.put("phonetype","N95"); jsonObject.put("cat","wp"); String jsonStr=jsonObject.toString(); } catch (JSONException e) { e.printStackTrace(); }