Skip to main content

Parameters

ParameterTypeDefaultDescription
configJSONLoaderConfigRequiredConfiguration object for JSON loading behavior

Functions

__init__

Initializes the JSONLoader with its specific configuration. Parameters:
  • config (JSONLoaderConfig): Configuration object for JSON loading behavior

get_supported_extensions

Gets the list of supported file extensions. Returns:
  • List[str]: List of supported file extensions (.json, .jsonl)

_execute_jq_query

Compiles and executes a JQ query on the given data. Parameters:
  • query (str): JQ query string to execute
  • data (Any): Data to query
Returns:
  • Any: Query results

_create_document_from_record

Creates a single Document from a JSON record using config mappers. Parameters:
  • record (Any): JSON record to create document from
  • base_metadata (Dict[str, Any]): Base metadata dictionary
  • document_id (str): Document ID
Returns:
  • Document: Created document

_process_json_object

Processes a parsed JSON object based on the configured mode. Parameters:
  • data (Any): Parsed JSON data
  • file_path (Path): Path to the source file
  • document_id (str): Document ID
Returns:
  • List[Document]: List of documents created from JSON data

_load_single_file

Loads and processes a single JSON or JSONL file. Parameters:
  • file_path (Path): Path to the JSON file
Returns:
  • List[Document]: List of documents loaded from the file

load

Loads documents from the given JSON source(s) synchronously. Parameters:
  • source (Union[str, Path, List[Union[str, Path]]]): JSON source(s) to load from
Returns:
  • List[Document]: List of loaded documents

_aload_single_file

Async: Loads and processes a single JSON or JSONL file. Parameters:
  • file_path (Path): Path to the JSON file
Returns:
  • List[Document]: List of documents loaded from the file

aload

Loads documents from the given JSON source(s) asynchronously. Parameters:
  • source (Union[str, Path, List[Union[str, Path]]]): JSON source(s) to load from
Returns:
  • List[Document]: List of loaded documents

batch

A simple synchronous batch load implementation. Parameters:
  • sources (List[Union[str, Path]]): List of JSON sources to load
Returns:
  • List[Document]: List of loaded documents

abatch

An efficient asynchronous batch load implementation. Parameters:
  • sources (List[Union[str, Path]]): List of JSON sources to load
Returns:
  • List[Document]: List of loaded documents
I