1#!/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:]:
9   print("formatting file {}".format(file))
10   with open(file) as f:
11      j = json.load(f)
12
13   with open(file, 'w') as f:
14      f.write(json.dumps(j, indent=4, sort_keys=True, separators=(',', ': ')))
15