Instead of having an extra view for the json representation Rails provides several nicer and more flexible ways to do this. For example this would create the exact same json response: 

format.json { render json: { is_deputy: @is_deputy, users: @users.to_json(only: :id, methods: :name } }

By the way: I just used the instance variables (with @) so it is easier to recognize, but since these variables are not longer needed in a view, they of course can also be simple local variables.

By the way 2: For detailed explanation of this code have a look here http://apidock.com/rails/ActiveRecord/Serialization/to_json and here http://guides.rubyonrails.org/layouts_and_rendering.html