import type { DocumentSource, FileInput } from './index.js'; import type { FileLoaderOptions } from './text.js'; /** Options for `loadJson()`. */ export interface JsonLoaderOptions extends FileLoaderOptions { /** * Picks the records out of the parsed file, which is then read whole. Defaults to the items of the * array at `recordsAt`, or of a top-level array, read as the file arrives; or else the value itself as * one record. */ records?: (value: unknown) => Iterable; /** * Where the array of records is: object keys from the top, dotted, such as `data.items`. Its items * are read one at a time as the file arrives, so a file larger than memory streams through. A file * with no array there is refused. */ recordsAt?: string; /** * A record's text: a field, by dotted path such as `body.text`, or a function. Defaults to a string * record itself, or else the record as indented JSON. */ text?: string | ((record: unknown) => string); /** A record's id, after the file name: a field by dotted path, or a function. Defaults to its position. */ id?: string | ((record: unknown, index: number) => string); /** Fields copied into the metadata, by dotted path, or a function that builds it. */ metadataFields?: readonly string[] | ((record: unknown) => Record); /** * Reads one JSON value per line (JSON Lines). Defaults to on for `.jsonl` and `.ndjson` files, so a * large export streams record by record. */ lines?: boolean; } /** * JSON and JSON Lines files, one document per record. A JSON Lines file, and the array of records in a * JSON one, are read as the file arrives, a record at a time, so a file larger than memory streams * through; a `records` function reads the file whole. */ export declare function loadJson(inputs: FileInput | Iterable, options?: JsonLoaderOptions): AsyncGenerator;