# JsonDataSource (@salmonui/data/json)

> The JsonDataSource interface of @salmonui/data/json.

Canonical: https://salmonui.dev/docs/reference/data/json/JsonDataSource

```ts
import type { JsonDataSource } from '@salmonui/data/json';
```

Also exported from `@salmonui/data`.

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

## Reference

Kind: interface

```ts
interface JsonDataSource<Row> extends DataSource<Row> {
    readonly mode: 'remote';
    read(request: DataSourceRequest & {
        readonly groupPath: readonly GroupPathSegment[];
    }): Promise<GroupLoadResult<Row>>;
    read(request: DataSourceRequest & {
        readonly parentRowId: RowId | null;
    }): Promise<TreeLoadResult<Row>>;
    read(request: DataSourceRequest): Promise<DataSourceResult<Row>>;
    write(request: WriteRequest<Row>): Promise<WriteResult<Row>>;
    subscribe(listener: (event: DataSourceEvent<Row>) => void): () => void;
    readonly capabilities: Partial<DataSourceCapabilities>;
    invalidate(scope?: 'rows' | 'counts' | 'facets' | 'all'): void;
    canReload(): boolean;
    reload(signal?: AbortSignalLike): Promise<DataSourceResult<Row>>;
    getRows(): readonly Row[];
    getWriteState(): WriteStateSnapshot<Row>;
    subscribeWriteState(listener: (event: WriteStateEvent) => void): () => void;
    dismissConflict(rowId: RowId): void;
    getStats(): Readonly<RunnerStats>;
}
```

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `mode` | `readonly mode: 'remote';` |  |  |
| `read` | `read(request: DataSourceRequest & {     readonly groupPath: readonly GroupPathSegment[]; }): Promise<GroupLoadResult<Row>>; read(request: DataSourceRequest & {     readonly parentRowId: RowId \| null; }): Promise<TreeLoadResult<Row>>; read(request: DataSourceRequest): Promise<DataSourceResult<Row>>;` |  |  |
| `write` | `write(request: WriteRequest<Row>): Promise<WriteResult<Row>>;` |  |  |
| `subscribe` | `subscribe(listener: (event: DataSourceEvent<Row>) => void): () => void;` |  |  |
| `capabilities` | `readonly capabilities: Partial<DataSourceCapabilities>;` |  |  |
| `invalidate` | `invalidate(scope?: 'rows' \| 'counts' \| 'facets' \| 'all'): void;` |  | Clears cached rows/counts/facets (or everything), cursor chains, infinite blocks, and lazy group loads. Does not notify. |
| `canReload` | `canReload(): boolean;` |  | True when no foreground read is in flight. |
| `reload` | `reload(signal?: AbortSignalLike): Promise<DataSourceResult<Row>>;` |  | Repeats the last foreground read, bypassing the cache. |
| `getRows` | `getRows(): readonly Row[];` |  | Rows of the last foreground result, including optimistic edits. |
| `getWriteState` | `getWriteState(): WriteStateSnapshot<Row>;` |  |  |
| `subscribeWriteState` | `subscribeWriteState(listener: (event: WriteStateEvent) => void): () => void;` |  |  |
| `dismissConflict` | `dismissConflict(rowId: RowId): void;` |  | Drops a conflict after review. |
| `getStats` | `getStats(): Readonly<RunnerStats>;` |  |  |
