Code example for JSONObject

Methods: optString

0
 
    JSONObject payload = request.getPayload();
 
    String js = template
        .replace(":sessionId", request.getSession())
        .replace(":x1", payload.optString("fromX"))
        .replace(":y1", payload.optString("fromY"))
        .replace(":x2", payload.optString("toX"))
        .replace(":y2", payload.optString("toY"))
        .replace(":duration", payload.optString("duration"));
    setJS(js);
  } 
 
  @Override 
  public JSONObject configurationDescription() throws JSONException {
    return noConfigDefined(); 
  } 
 
}