blob: 77dba501439148f2399edd73cc087b577b6b73a6 [file] [log] [blame]
James Feist678715a2018-12-11 15:34:43 -08001#!/usr/bin/python3
2# all arguments to this script are considered as json files
3# and attempted to be formatted alphabetically
4
5import json
6from sys import argv
7
8for file in argv[1:]:
Patrick Williamsa3db66b2022-12-04 16:27:08 -06009 print("formatting file {}".format(file))
10 with open(file) as f:
11 j = json.load(f)
James Feist678715a2018-12-11 15:34:43 -080012
Patrick Williamsa3db66b2022-12-04 16:27:08 -060013 with open(file, "w") as f:
14 f.write(
15 json.dumps(j, indent=4, sort_keys=True, separators=(",", ": "))
16 )