I am looking for a way to convert a String to a JSON object and vice versa.
I have a String with JSON notation as value. I need to convert this value to JSON object in order to get specific data out of the JSON objects. Afterwarts, i need to convert a specific JSON object (attribute) to an JAVA attribute.
Does anyone know how to achieve this? I know Java has the import org.json.JSONObject;
which enables me to create JSONObjects, but i cannot figure out how to convert my JSON String to a JSON object.
You can use the JSONObject constructor
public JSONObject(java.lang.String source) throws JSONException
http://www.json.org/javadoc/org/json/JSONObject.html#JSONObject%28java.lang.String%29