Code example for JSONObject

Methods: puttoString

  public String toJSON() throws JSONException {
    return toJSON(0); 
  public String toJSON(int i) throws JSONException {
    JSONObject o = new JSONObject();
    o.put("method", method);
    o.put("path", path);
    o.put("payload", payload);
    return o.toString(i);
  public String getMethod() {
    return method;
  public String getPath() {
    return path;
Connect your IDE to all the code out there  Get Codota for Java