1#!/usr/bin/env python3 2 3import glob 4import json 5import sys 6 7if len(sys.argv) != 2: 8 print("This program reformats JSON files in-place. You must provide a glob pattern of files to process as its argument.") 9else: 10 for cfg in glob.glob(sys.argv[1]): 11 with open(cfg, "r") as fr: 12 j = json.load(fr) 13 with open(cfg, "w") as fw: 14 json.dump(j, fw, indent="\t") 15 fw.write("\n")