# JsonQueryHandlerOptions (@salmonui/data/server)

> The JsonQueryHandlerOptions interface of @salmonui/data/server.

Canonical: https://salmonui.dev/docs/reference/data/server/JsonQueryHandlerOptions

```ts
import type { JsonQueryHandlerOptions } from '@salmonui/data/server';
```

Entry index: https://salmonui.dev/docs/reference/data/server (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data/server.md).

## Reference

Kind: interface

```ts
interface JsonQueryHandlerOptions {
    readonly key: string;
    readonly fields?: readonly string[];
    readonly types?: Readonly<Record<string, WireType>>;
    readonly dict?: readonly string[] | 'auto';
    readonly parentField?: string;
    readonly versionField?: string;
    readonly validate?: (row: Obj) => readonly {
        readonly field?: string;
        readonly code: string;
        readonly message: string;
    }[];
    readonly nextKey?: () => Json;
    readonly facetLimit?: number;
    readonly lookups?: Readonly<Record<string, readonly Obj[]>>;
    readonly lookupFields?: Readonly<Record<string, {
        readonly lookup: string;
        readonly keyField: string;
        readonly displayField: string;
    }>>;
}
```

Members (11):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key: string;` |  |  |
| `fields` | `readonly fields?: readonly string[];` | optional | Full field list (default: keys of the first row). |
| `types` | `readonly types?: Readonly<Record<string, WireType>>;` | optional | Wire types per field (default: inferred from the first row; `Date` values are `date`). |
| `dict` | `readonly dict?: readonly string[] \| 'auto';` | optional | Dictionary-encode these string fields, or `'auto'`. Default none. |
| `parentField` | `readonly parentField?: string;` | optional | Tree data: field holding the parent key (blank for roots). Tree reads (`parent`, `null` for the root level) return that level's children with `childCounts`; with a filter or search they return every match with its ancestor chain (`filterMode: 'ancestors'`) in pre-order, with `parents`, `depths`, and `childCounts` of the kept children, paged by top-level row. Aggregates cover the kept rows of every depth. Writes: `parents` sets the parent of added rows, deleting a row deletes its subtree, `moved` sets the parent of moved rows and places them next to `target`. |
| `versionField` | `readonly versionField?: string;` | optional | Row version field; incremented on every change and checked against `version`. |
| `validate` | `readonly validate?: (row: Obj) => readonly {     readonly field?: string;     readonly code: string;     readonly message: string; }[];` | optional | Validation for added and changed rows. |
| `nextKey` | `readonly nextKey?: () => Json;` | optional | Key generator for added rows whose key is null. |
| `facetLimit` | `readonly facetLimit?: number;` | optional | Max facet entries. Default 1000. |
| `lookups` | `readonly lookups?: Readonly<Record<string, readonly Obj[]>>;` | optional | Lookup tables answered for `{ v: 1, lookup: { name, keys, keyField } }`. |
| `lookupFields` | `readonly lookupFields?: Readonly<Record<string, {     readonly lookup: string;     readonly keyField: string;     readonly displayField: string; }>>;` | optional | Fields holding a lookup key (lookup / foreign-key columns): sorting and grouping by such a field order rows and groups by the `displayField` of the matching row of `lookups[lookup]` (a server-side join), then by the key. Group keys, filters and the returned rows keep the key. |
