If you want to read the whole file, you can use loader_cls
params:
from langchain.document_loaders import DirectoryLoader, TextLoader
loader = DirectoryLoader(DRIVE_FOLDER, glob='**/*.json', show_progress=True, loader_cls=TextLoader)
Also, you can use JSONLoader
with schema params like:
from langchain.document_loaders.json_loader import JSONLoader
DRIVE_FOLDER = "/content/drive/MyDrive/Colab Notebooks/demo"
loader = DirectoryLoader(DRIVE_FOLDER, glob='**/*.json', show_progress=True, loader_cls=JSONLoader, loader_kwargs = {'jq_schema':'.content'})
documents = loader.load()
print(f'document count: {len(documents)}')
print(documents[0] if len(documents) > 0 else None)\
jq_schema
You can follow this:
https://github.com/hwchase17/langchain/blob/master/langchain/document_loaders/json_loader.py#L10
more usage for DirectoryLoader
: https://github.com/hwchase17/langchain/blob/master/langchain/document_loaders/directory.py