Mr. Sajid Shaikh Mr. Sajid Shaikh - 1 year ago 132
JSON Question

How to convert String to JSONObject in Java

I have String variable called



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

Answer Source

Using org.json library:

    JSONObject jsonObj = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download