Parameters
Parameter | Type | Default | Description |
---|---|---|---|
config | JSONLoaderConfig | Required | Configuration 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 executedata
(Any): Data to query
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 frombase_metadata
(Dict[str, Any]): Base metadata dictionarydocument_id
(str): Document ID
Document
: Created document
_process_json_object
Processes a parsed JSON object based on the configured mode.
Parameters:
data
(Any): Parsed JSON datafile_path
(Path): Path to the source filedocument_id
(str): Document ID
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
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
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
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
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
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
List[Document]
: List of loaded documents