diff --git a/db.py b/db.py index a085987..1a7cb6d 100644 --- a/db.py +++ b/db.py @@ -31,12 +31,15 @@ class ClutterDB: else: return None + def all(self): + with open(self.path_to_json, mode="r") as json_file: + return json.load(json_file) + def rem(self, key: str): with open(self.path_to_json, mode="r") as json_file: json_data = json.load(json_file) with open(self.path_to_json, mode="w") as json_file: - json_data.pop(key, None) - json.dump(json_data, json_file, indent=4) + json.dump(json_data.pop(key, None), json_file, indent=4) def nuke(self): with open(self.path_to_json, mode="w") as json_file: