code: private Month readOptionalMonth(JSONObject json, String key) {
  
          try {
              String str = json.getString(key);
              return Month.valueOf(str);
          } catch (JSONException | IllegalArgumentException e) {
              LOG.debug("Reading optional JSON month failed. Default to provided default value.", e);
          }
          return null;
      }
docs: Read an optional month value (stored as string) form a JSON Object.
  @param json the JSON object to read from.
  @param key the key for the month value in the provided JSON object.
  @return the month or null if reading the month fails.