File size: 469 Bytes
46c0fca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import os
import glob
import sys
import json
for file in glob.glob("results/*/*/*.json"):
# if the file is greater than 9 MB, compress it with gzip
if os.path.getsize(file) >= 9.5 * 1024 * 1024:
print(f"Resizing {file} to have no indentations")
# read it in as json and write it out with no indent
with open(file, "r") as f:
data = json.load(f)
with open(file, "w") as f:
json.dump(data, f, indent=None) |