code: private SortedSet<Date> readDates(JSONArray array) {
  
          if (null != array) {
              SortedSet<Date> result = new TreeSet<>();
              for (int i = 0; i < array.length(); i++) {
                  try {
                      long l = Long.valueOf(array.getString(i)).longValue();
                      result.add(new Date(l));
                  } catch (NumberFormatException | JSONException e) {
                      LOG.error("Could not read date from JSON array.", e);
                  }
              }
              return result;
          }
          return new TreeSet<>();
      }
docs: Extracts the dates from a JSON array.
  @param array the JSON array where the dates are stored in.
  @return list of the extracted dates.