The best way to handle this is to provide just two routes.
Something like this:
get "/json" do
return json
end
get "/file/:name" do |filename|
send_file file.filePath, :filename => file.fileName, :disposition => 'attachment'
end
And in your json respons you include the path to your file.