title: How to make Devise respond to both html and json?
body: <p>I am overriding the Devise Registrations and Sessions controller to respond to both html and json  </p>
  
  <p>Code for Registration Controller :</p>
  
  <pre><code>class RegistrationsController &lt; Devise::RegistrationsController
  
    def create
      @user = User.create(user_params)
      if @user.save
  
  
        render :json =&gt; {:state =&gt; {:code =&gt; 0}, :data =&gt; @user }
      else
        render :json =&gt; {:state =&gt; {:code =&gt; 1, :messages =&gt; @user.errors.full_messages} }
      end
    end
  
  private
  
    def user_params
       params.require(:user).permit(:email, :password)
    end
  end 
  </code></pre>
  
  <p>Currently this Registrations controller is only responding to json request. How to make this controller respond to both json and html request ?</p>