Created
February 25, 2018 02:37
-
-
Save theresama/177c1f0e39bf2aebc82ce8b5fcb4cb57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import collections | |
import json | |
def main(argv=None): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('json_file') | |
args = parser.parse_args(argv) | |
with open(args.json_file, 'r') as f: | |
ugly_json = json.load(f, object_pairs_hook=collections.OrderedDict) | |
with open(args.json_file, 'w') as w: | |
json.dump(ugly_json, w, indent=2) | |
if __name__ == "__main__": | |
exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment