Nikhil0987 commited on
Commit
6b6846f
·
verified ·
1 Parent(s): fd496d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -6,18 +6,22 @@ import json
6
  import uuid
7
 
8
 
9
- def userinvoke():
10
- with open("test.json") as file:
11
- usersss = json.load(file)
12
- return usersss
13
-
14
-
15
- users = userinvoke()
16
-
17
-
18
- routines = users[0]["routines"]
19
-
20
- reminders = routines["reminders"][0]
 
 
 
 
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