Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,18 +6,22 @@ import json
|
|
6 |
import uuid
|
7 |
|
8 |
|
9 |
-
def
|
10 |
-
with open("test.json") as file:
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
|
22 |
|
23 |
|
|
|
6 |
import uuid
|
7 |
|
8 |
|
9 |
+
def add_to_json(new_data):
|
10 |
+
with open("test.json", "r") as file:
|
11 |
+
existing_data = json.load(file)
|
12 |
+
|
13 |
+
# Assuming you want to add 'new_goal' and 'reminder' into existing_data
|
14 |
+
existing_data.update(new_data)
|
15 |
+
|
16 |
+
with open("test.json", "w") as file:
|
17 |
+
json.dump(existing_data, file, indent=4)
|
18 |
+
|
19 |
+
# Usage:
|
20 |
+
new_data = {
|
21 |
+
"new_goal": "Master Streamlit",
|
22 |
+
"reminder": "Read tutorials"
|
23 |
+
}
|
24 |
+
add_to_json(new_data)
|
25 |
|
26 |
|
27 |
|