Code example for JSONObject

Methods: optString

    JSONObject payload = request.getPayload();
    String js = voidTemplate
            .replace(":sessionId", request.getSession())
            .replace(":reference", request.getVariableValue(":reference"))
            .replace("xstart", payload.optString("xstart"))
            .replace("ystart", payload.optString("ystart"))
            .replace("xend", payload.optString("xend"))
            .replace("yend", payload.optString("yend"))
            .replace("touchCountx", payload.optString("touchCount"));
  public JSONObject configurationDescription() throws JSONException {
    return null;  //To change body of implemented methods use File | Settings | File Templates. 
Stop searching for code, let great code find you!  Add Codota to your java IDE