{"action":"opened","issue":{"url":"https://api.github.com/repos/FriendsOfCake/crud/issues/339","labels_url":"https://api.github.com/repos/FriendsOfCake/crud/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfCake/crud/issues/339/comments","events_url":"https://api.github.com/repos/FriendsOfCake/crud/issues/339/events","html_url":"https://github.com/FriendsOfCake/crud/issues/339","id":114912158,"number":339,"title":"Can not override the output type to json to acquire auto-generated response","user":{"login":"martinkryl","id":4144447,"avatar_url":"https://avatars.githubusercontent.com/u/4144447?v=3","gravatar_id":"","url":"https://api.github.com/users/martinkryl","html_url":"https://github.com/martinkryl","followers_url":"https://api.github.com/users/martinkryl/followers","following_url":"https://api.github.com/users/martinkryl/following{/other_user}","gists_url":"https://api.github.com/users/martinkryl/gists{/gist_id}","starred_url":"https://api.github.com/users/martinkryl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinkryl/subscriptions","organizations_url":"https://api.github.com/users/martinkryl/orgs","repos_url":"https://api.github.com/users/martinkryl/repos","events_url":"https://api.github.com/users/martinkryl/events{/privacy}","received_events_url":"https://api.github.com/users/martinkryl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-03T21:16:32Z","updated_at":"2015-11-03T21:16:32Z","closed_at":null,"body":"Dear all, I was looking around for a solution to removing `.json` extension from a API url, and all the methods I have used in my beforeFilter (one is enabled, others commented out) have resulted in a error message of non-existent view. The app was looking in a `Users/json/` subdirectory though and when I created that view manually, it did output proper json.\r\n\r\nWhen I use the same url with the `.json` extension, the auto-generation of the response works as expected.\r\n\r\nI am using cakephp 3.1 and CRUD 4.\r\n\r\nHere is my controller:\r\n```php\r\n<?php\r\nnamespace App\\Controller\\Api;\r\n\r\nuse Cake\\Controller\\Controller;\r\nuse Cake\\Event\\Event;\r\n\r\nclass UsersController extends Controller {\r\n\r\n    use \\Crud\\Controller\\ControllerTrait;\r\n\r\n    //public $viewClass = 'Json';\r\n\r\n    public $components = [\r\n        'RequestHandler',\r\n        'Crud.Crud' => [\r\n            'actions' => [\r\n                'Crud.Index',\r\n                'Crud.View',\r\n                'Crud.Add',\r\n                'Crud.Edit',\r\n                'Crud.Delete'\r\n            ],\r\n            'listeners' => [\r\n                'Crud.Api',\r\n                //'Crud.ApiPagination',\r\n                //'Crud.ApiQueryLog'\r\n            ]\r\n        ]\r\n    ];\r\n\r\n    public function beforeFilter(Event $event)\r\n    {\r\n        parent::beforeFilter($event);\r\n        //$this->RequestHandler->ext = 'json';\r\n        $this->RequestHandler->renderAs($this,   'json');\r\n        //$this->viewClass = 'Json';\r\n    }\r\n}\r\n```"}}