code: public JSONObject getJSONObject(String key) throws JSONException {
      Object o = get(key);
      if (o instanceof JSONObject) {
        return (JSONObject) o;
      }
      throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONObject.");
    }
docs: Get the JSONObject value associated with a key.
  
  @param key
  A key string.
  @return A JSONObject which is the value.
  @throws JSONException
  if the key is not found or if the value is not a JSONObject.