Skip to main content

Interface: JSONReaderOptions

Properties

cleanJson?

optional cleanJson: boolean

Whether to clean the JSON by filtering out structural characters ({}, [], and ,). If set to false, it will just parse the JSON, not removing structural characters.

Default

true

Defined in

packages/llamaindex/src/readers/JSONReader.ts:43


collapseLength?

optional collapseLength: number

The maximum length of JSON string representation to be collapsed into a single line. Only applicable when levelsBack is set.

Default

undefined

Defined in

packages/llamaindex/src/readers/JSONReader.ts:59


ensureAscii?

optional ensureAscii: boolean

Whether to ensure only ASCII characters. Converts non-ASCII characters to their unicode escape sequence.

Default

false

Defined in

packages/llamaindex/src/readers/JSONReader.ts:26


isJsonLines?

optional isJsonLines: boolean

Whether the JSON is in JSON Lines format. Split into lines, remove empty lines, parse each line as JSON. Note: Uses a custom streaming parser, most likely less robust than json-ext

Default

false

Defined in

packages/llamaindex/src/readers/JSONReader.ts:35


levelsBack?

optional levelsBack: number

Specifies how many levels up the JSON structure to include in the output. cleanJson will be ignored. If set to 0, all levels are included. If undefined, parses the entire JSON and treats each line as an embedding.

Default

undefined

Defined in

packages/llamaindex/src/readers/JSONReader.ts:51


logger?

optional logger: Logger

A placeholder for a custom logging function.

Default

consoleLogger

Defined in

packages/llamaindex/src/readers/JSONReader.ts:65


streamingThreshold?

optional streamingThreshold: number

The threshold for using streaming mode. Give the approximate size of the JSON data in MB. Estimates character length by calculating: "(streamingThreshold * 1024 * 1024) / 2" and comparing against string.length Streaming mode avoids memory issues when parsing large JSON data. Set "undefined" to disable streaming or "0" to always use streaming.

Default

50 MB

Defined in

packages/llamaindex/src/readers/JSONReader.ts:18