import json import argparse parser = argparse.ArgumentParser(description='JSON TOOL') parser.add_argument('file') args = parser.parse_args() if args.file: with open(args.file, 'r', encoding='utf8', errors='strict') as json_file: obj = json.load(json_file) with open('pretty_'+args.file, 'w', encoding='utf8', errors='strict') as json_file: json.dump(obj, json_file, indent=4, ensure_ascii=False)