// region toJson/toString()
 public JSONObject toJson() {
   JSONObject jsonObject = new JSONObject();
   try {
     if (isRootRequired()) {
       jsonObject.put("root", true);
     }
     if (optional) {
       jsonObject.put("optional", true);
     }
     jsonObject.put("name", getName());
     if (getArguments().length > 0) {
       JSONArray jsonArray = new JSONArray();
       for (ActionArgument argument : getArguments()) {
         jsonArray.put(argument.toJson());
       }
       jsonObject.put("arguments", jsonArray);
     }
     jsonObject.put("description", getDescription());
     jsonObject.put("category", getCategory().toString());
     if (failure != null) {
       jsonObject.put("failure", failure);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
   return jsonObject;
 }