Code example for JSONObject

Methods: optString

0
 
    JSONObject payload = request.getPayload();
 
    String js = voidTemplate
            .replace(":sessionId", request.getSession())
            .replace("fromX", payload.optString("fromX"))
            .replace("fromY", payload.optString("fromY"))
            .replace("toX", payload.optString("toX"))
            .replace("toY", payload.optString("toY"))
            .replace("duration", payload.optString("duration"));
 
 
    setJS(js);
  } 
 
  @Override 
  public JSONObject configurationDescription() throws JSONException {
    return null;  //To change body of implemented methods use File | Settings | File Templates. 
  } 
}