Well I fond this post because I got a similar error. So I added the top line like in your controller respond_to :html, :json
then I got a different error(see below)
The controller-level respond_to' feature has been extracted to the
responders` gem. Add it to your Gemfile to continue using this feature: gem 'responders', '~> 2.0' Consult the Rails upgrade guide for details.
But that had nothing to do with it.