diff --git a/json_memoize.py b/json_memoize.py index 4b62f9c..6df65b5 100644 --- a/json_memoize.py +++ b/json_memoize.py @@ -32,7 +32,11 @@ def json_memoize(filename): if json_key not in memo: memo[json_key] = self.fn(*args, **kwargs) with open(filename, "w") as f: - json.dump(memo, f) + json.dump(memo, f, + indent=4, + separators=(',', ': '), + sort_keys=True) + f.write("\n") return memo[json_key] return JsonMemoize