# Read URL parameters in a route

> Declare dynamic segments such as {id} in a route and read them from $.params.

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: en
Content-SHA256: a45ca90c0ed6335f89cecb2eedc19c0abb8191d26bbe2f487b4f2e3ff7f7b76f
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

Wrap a segment of the URL in curly braces and Total.js exposes its value in `$.params`. A route can contain as many parameters as you need.

```js controllers/users.js
exports.install = function() {
	ROUTE('GET /users/{id}/', show_user);
	ROUTE('GET /users/{id}/posts/{post}/', show_post);
};

function show_user($) {
	$.json({ id: $.params.id });
}

function show_post($) {
	$.json({ id: $.params.id, post: $.params.post });
}
```

`$.json()` sends the value as JSON. Parameters are always strings; validate or convert them yourself, or declare their types in an action (see the actions recipe).
