Update app.py
Browse files
app.py
CHANGED
@@ -50,18 +50,18 @@ def get_csv_file(csv_docs):
|
|
50 |
def get_json_file(json_docs):
|
51 |
temp_dir = tempfile.TemporaryDirectory()
|
52 |
json_loader=JSONLoader(
|
53 |
-
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
jq_schema='.',
|
55 |
text_content=False,
|
56 |
json_lines=True
|
57 |
)
|
58 |
-
|
59 |
-
s = f.write(json_docs.getvalue())
|
60 |
-
s = s.replace('\t','')
|
61 |
-
s = s.replace('\n','')
|
62 |
-
s = s.replace(',}','}')
|
63 |
-
s = s.replace(',]',']')
|
64 |
-
json_doc = json_loader.loads(s)
|
65 |
return json_doc
|
66 |
|
67 |
|
|
|
50 |
def get_json_file(json_docs):
|
51 |
temp_dir = tempfile.TemporaryDirectory()
|
52 |
json_loader=JSONLoader(
|
53 |
+
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
54 |
+
with open(temp_filepath, "wb") as f:
|
55 |
+
s = f.write(json_docs.getvalue())
|
56 |
+
s = s.replace('\t','')
|
57 |
+
s = s.replace('\n','')
|
58 |
+
s = s.replace(',}','}')
|
59 |
+
s = s.replace(',]',']'),
|
60 |
jq_schema='.',
|
61 |
text_content=False,
|
62 |
json_lines=True
|
63 |
)
|
64 |
+
json_doc = json_loader.load()
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
return json_doc
|
66 |
|
67 |
|