code: public JSONObject toJson() {
  
          try {
              JSONObject result = new JSONObject();
              if (null != getStart()) {
                  result.put(JsonKey.START, dateToJson(getStart()));
              }
              if (null != getEnd()) {
                  result.put(JsonKey.END, dateToJson(getEnd()));
              }
              if (isWholeDay()) {
                  result.put(JsonKey.WHOLE_DAY, true);
              }
              JSONObject pattern = patternToJson();
              result.put(JsonKey.PATTERN, pattern);
              SortedSet<Date> exceptions = getExceptions();
              if (!exceptions.isEmpty()) {
                  result.put(JsonKey.EXCEPTIONS, datesToJson(exceptions));
              }
              switch (getEndType()) {
                  case DATE:
                      result.put(JsonKey.SERIES_ENDDATE, dateToJson(getSeriesEndDate()));
                      break;
                  case TIMES:
                      result.put(JsonKey.SERIES_OCCURRENCES, String.valueOf(getOccurrences()));
                      break;
                  case SINGLE:
                  default:
                      break;
              }
              if (!isCurrentTillEnd()) {
                  result.put(JsonKey.CURRENT_TILL_END, false);
              }
              if (null != getParentSeriesId()) {
                  result.put(JsonKey.PARENT_SERIES, getParentSeriesId().getStringValue());
              }
              return result;
          } catch (JSONException e) {
              LOG.error("Could not convert Serial date value to JSON.", e);
              return null;
          }
      }
docs: Convert the information from the wrapper to a JSON object.
  @return the serial date information as JSON.