code: private Boolean readOptionalBoolean(JSONObject json, String key) {
  
          try {
              return Boolean.valueOf(json.getBoolean(key));
          } catch (JSONException e) {
              LOG.debug("Reading optional JSON boolean failed. Default to provided default value.", e);
          }
          return null;
      }
docs: Read an optional boolean value form a JSON Object.
  @param json the JSON object to read from.
  @param key the key for the boolean value in the provided JSON object.
  @return the boolean or null if reading the boolean fails.