title: added root in grape api but not included in response
body: <p>I am following <a href="https://www.thegreatcodeadventure.com/making-a-rails-api-with-grap/" rel="nofollow noreferrer">this</a> article to learn about writing api using <a href="https://github.com/ruby-grape/grape" rel="nofollow noreferrer">grape gem</a>. But in the response I am not getting the root key. Here is my directory structure,</p>
  <pre><code>app
   |––controllers
         |––api
             |––base.rb
             |––v1
                 |––base.rb
                 |––graduates.rb
  </code></pre>
  <p>In app/controllers/api/v1/graduates.rb:</p>
  <pre><code>module API
    module V1
      class Graduates &lt; Grape::API
        include API::V1::Defaults
    resource :graduates do
      desc &quot;Return all graduates&quot;
      get &quot;&quot;, root: :graduates do
        Graduate.all
      end
  
      desc &quot;Return a graduate&quot;
      params do
        requires :id, type: String, desc: &quot;ID of the 
          graduate&quot;
      end
      get &quot;:id&quot;, root: &quot;graduate&quot; do
        Graduate.where(id: permitted_params[:id]).first!
      end
    end
  end
  </code></pre>
  <p>end
  end</p>
  <p>in app/controllers/api/v1/defaults.rb</p>
  <pre><code>module API
    module V1
      module Defaults
        extend ActiveSupport::Concern
    included do
      prefix &quot;api&quot;
      version &quot;v1&quot;, using: :path
      default_format :json
      format :json
      formatter :json, 
           Grape::Formatter::ActiveModelSerializers
  
      helpers do
        def permitted_params
          @permitted_params ||= declared(params, 
             include_missing: false)
        end
  
        def logger
          Rails.logger
        end
      end
  
      rescue_from ActiveRecord::RecordNotFound do |e|
        error_response(message: e.message, status: 404)
      end
  
      rescue_from ActiveRecord::RecordInvalid do |e|
        error_response(message: e.message, status: 422)
      end
    end
  end
  </code></pre>
  <p>end
  end</p>
  <p>I have used <code>grape-active_model_serializers</code> gem to serialize like the following,
  In app/serializers/graduate_serializer.rb</p>
  <pre><code>class GraduateSerializer &lt; ActiveModel::Serializer
    attributes :id, :name
  end
  </code></pre>
  <p>I got the following output. <code>[{&quot;id&quot;:1,&quot;name&quot;:&quot;aaaa&quot;},{&quot;id&quot;:2,&quot;name&quot;:&quot;bbbb&quot;},{&quot;id&quot;:3,&quot;name&quot;:&quot;cccc&quot;},{&quot;id&quot;:4,&quot;name&quot;:&quot;dddd&quot;}]</code></p>
  <p>But As I added  <code>get &quot;&quot;, root: :graduates do</code> in <code>app/controllers/api/v1/graduates.rb</code> file, I am expecting the following output,</p>
  <pre><code>{&quot;graduates&quot;: [{&quot;id&quot;:1,&quot;name&quot;:&quot;aaaa&quot;},{&quot;id&quot;:2,&quot;name&quot;:&quot;bbbb&quot;},{&quot;id&quot;:3,&quot;name&quot;:&quot;cccc&quot;},{&quot;id&quot;:4,&quot;name&quot;:&quot;dddd&quot;}]}
  </code></pre>
  <p>What I am missing. why <code>graduates</code> is not added as root. Help me to fix this issue.</p>