diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 462d4e461e134d008c94c2f5648efaee88e38a13..2de8ada3e29604cf787c3d879697ffeae2cd66d0 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -19,7 +19,7 @@ class Projects::BranchesController < Projects::ApplicationController
     respond_to do |format|
       format.html
       format.json do
-        render json: @repository.branch_names.to_json
+        render json: @repository.branch_names
       end
     end
   end
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb
index 79abba21854309b77ba86fadfdc721d4d636e1f0..1b14945bf0a7fbd951f239a05abe3752c3725719 100644
--- a/spec/features/projects/branches_spec.rb
+++ b/spec/features/projects/branches_spec.rb
@@ -20,7 +20,7 @@ describe 'Branches', feature: true do
 
   describe 'Find branches' do
     it 'shows filtered branches', js: true do
-      visit namespace_project_branches_path(project.namespace, project, project.id)
+      visit namespace_project_branches_path(project.namespace, project)
 
       fill_in 'branch-search', with: 'fix'
       find('#branch-search').native.send_keys(:enter)