code: public JSONObject getJSONObject( int index ) {
        Object o = get( index );
        if( JSONNull.getInstance()
              .equals( o ) ){
           return new JSONObject( true );
        }else if( o instanceof JSONObject ){
           return (JSONObject) o;
        }
        throw new JSONException( "JSONArray[" + index + "] is not a JSONObject." );
     }
docs: Get the JSONObject associated with an index.
  
  @param index subscript
  @return A JSONObject value.
  @throws JSONException If there is no value for the index or if the value
  is not a JSONObject