I have one string from which I want to create one jsonobject
import org.json.JSONObject;
JSONObject json=new JSONObject("{success=false, errorMessage=Application with appId : [randomAppId] not registered, errorCode=102}");
System.out.println("JSON:"+json.toString());
BUT right now I'm getting exception due to characters like :,[,] which is inside the string.
Stacktrace:
Exception in thread "main" org.json.JSONException: Expected a ',' or '}' at character 53
at org.json.JSONTokener.syntaxError(JSONTokener.java:410)
at org.json.JSONObject.<init>(JSONObject.java:222)
at org.json.JSONObject.<init>(JSONObject.java:402)