Can't get JSON route to work in basic application

I’m trying to learn about JSON routes, so I whipped up a fresh “bookmarker tutorial” app and tried adding the option for using a /bookmarks.json URL. But I’m getting an error message saying that the

Template file “Bookmarks/json/index.ctp” is missing.

Here’s what I tried: I installed a new version of the bookmarker tutorial from the cakePHP site; baked the scaffolded, hash-protected the passwords; added a user; added a few bookmarks. Then I tried two different approaches to adding a json option to the ‘config/routes.php’ file:


and then when that didn’t work, I tried

Router::scope('/', function (RouteBuilder $routes) {


(Those methods are both mentioned in : )

I confirmed that I have a call to the RequestHandler in my AppController.php file.


You can see a git repo of these developments at:

Any idea what I’m doing wrong?

(This, of course, it not what I’m trying to work on. This was supposed to be the easy setup so I could start learning about making it more complex…)


try to also add in controller action

$this->set('_serialize', ['bookmarks']);


1 Like

That worked great - thank you!