File size: 320 Bytes
4f194a4
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import json

from llama_index.schema import Document


def load_json_file_and_extract_text(json_file_path):
    documents = []
    with open(json_file_path, "r") as json_file:
        json_data = json.load(json_file)
        documents.append(Document(doc_id=json_file_path, text=json_data["text"]))
    return documents