Talib Talib - 2 months ago 46
Java Question

Converting string to json object using json.simple

I am using

I want to convert
to Json

String value=request.getParameter("savepos");
JSONObject jsonObject = (JSONObject) JSONValue.parse(value);

It doesn't work. Why?

Answer Source

Try this:

JSONParser parser = new JSONParser();
JSONObject json = (JSONObject) parser.parse(stringToParse);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download