# selection.decodeWhereDocument

- **Module:** selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ts/blob/46cccfef2a546de55ce8b308249b8c76339089a0/packages/libtmux/src/selection.ts#L629
- **Page:** https://libtmux.org/en/ts/latest/reference/selection-decodewheredocument/

```
function decodeWhereDocument(
  input: unknown,
): WhereDocumentV1
```

Validate a WHERE document and restore camelCase criteria names.

The returned document is canonical and deeply frozen.

## Examples

```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);
```

## Parameters

- `input` (`unknown`)

## Raises

- [`QueryValidationError`](/en/ts/latest/reference/errors-queryvalidationerror/): when the document or its criteria are invalid.

## Guides

Pages that discuss `decodeWhereDocument`.

- [Filtering and queries](/en/ts/latest/concepts/queries/)
