It allows you to omit templates if you just need to emit JSON string as response.
In your controller, you could do the following:
$this->set(['posts' => $posts]);
$this->set('_serialize', true);
When the view is rendered, the $posts view variable will be serialized
into JSON.
You can also set multiple view variables for serialization. This will create
a top level object containing all the named view variables:
$this->set(compact('posts', 'users', 'stuff'));
$this->set('_serialize', true);
The above would generate a JSON object that looks like:
{"posts": [...], "users": [...]}
You can also set '_serialize' to a string or array to serialize only the
specified view variables.
If you don't use the _serialize, you will need a view template. You can use
extended views to provide layout-like functionality.
You can also enable JSONP support by setting parameter _jsonp to true or a
string to specify custom query string parameter name which will contain the
callback function name.