# selection.decodeWhereDocument

- **Module:** selection
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/selection.ts#L541
- **Page:** https://libtmux.org/reference/ts/selection-decodewheredocument/

```
selection.decodeWhereDocument(input: : unknown) -> WhereDocumentV1
```

Validate a WHERE document and restore camelCase criteria names.

The returned document is canonical and deeply frozen.

## Raises

- `QueryValidationError` — when the document or its criteria are invalid.

## Example

```ts
import { decodeWhereDocument } from "libtmux/selection";
const document = decodeWhereDocument(
  JSON.parse('{"model":"pane","version":1,"where":{"pane_title":"logs"}}'),
);
if (document.model === "pane") snapshot.panes.where(document.where);
```
