I'm just getting started with Symfony2 and I'm trying to figure out what the correct approach is for echoing out JSON from a controller (e.g., `People`) for use in an ExtJS 4 grid.

When I was doing everything using a vanilla MVC approach, my controller would have method called something like `getList` that would call the `People` model's `getList` method, take those results and do something like this:

```
<?php
class PeopleController extends controller {
    public function getList() {
        $model = new People();
        $data = $model->getList();
        echo json_encode(array(
            'success' => true,
            'root' => 'people',
            'rows' => $data['rows'],
            'count' => $data['count']
        ));
    }
}
?>

```

* What does this kind of behavior look like in Symfony2?
* Is the controller the right place for this kind of behavior?
* What are the best practices (within Symfony) for solving this kind of problem?