code: protected JSONObject getJSONObject(final String key, final JSONObject jsonObject) {
      JSONObject json = null;
      try {
        if(hasKey(key, jsonObject)) {
          json = jsonObject.getJSONObject(key);
        }
      }
      catch(JSONException e) {
        LOGGER.error("Could not get JSONObject from JSONObject for key: " + key, e);
      }
      return json;
    }
docs: Check to make sure the JSONObject has the specified key and if so return
  the value as a JSONObject. If no key is found null is returned.
  
  @param key name of the field to fetch from the json object
  @param jsonObject object from which to fetch the value
  
  @return json object value corresponding to the key or null if key not found