code: public JSONValue toJson() {
  
          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, JSONBoolean.getInstance(true));
          }
          JSONObject pattern = patternToJson();
          result.put(JsonKey.PATTERN, pattern);
          SortedSet<Date> exceptions = getExceptions();
          if (exceptions.size() > 0) {
              result.put(JsonKey.EXCEPTIONS, datesToJsonArray(exceptions));
          }
          switch (getEndType()) {
              case DATE:
                  result.put(JsonKey.SERIES_ENDDATE, dateToJson(getSeriesEndDate()));
                  break;
              case TIMES:
                  result.put(JsonKey.SERIES_OCCURRENCES, new JSONString(String.valueOf(getOccurrences())));
                  break;
              case SINGLE:
              default:
                  break;
          }
          if (!isCurrentTillEnd()) {
              result.put(JsonKey.CURRENT_TILL_END, JSONBoolean.getInstance(false));
          }
          if (getParentSeriesId() != null) {
              result.put(JsonKey.PARENT_SERIES, new JSONString(getParentSeriesId().getStringValue()));
          }
          return result;
      }
docs: Convert the information from the wrapper to a JSON object.
  @return the serial date information as JSON.