Skip to content

Instantly share code, notes, and snippets.

@ansakoy
Created April 16, 2018 21:28
Show Gist options
  • Save ansakoy/71850d9fa8c279fe063990b92d764e6b to your computer and use it in GitHub Desktop.
Save ansakoy/71850d9fa8c279fe063990b92d764e6b to your computer and use it in GitHub Desktop.
import json
def load_json(source):
with open(source, 'r') as handler:
return json.load(handler)
def load_utf_json(source):
with open(source, 'r', encoding="utf8") as handler:
return json.load(handler)
def dump_json(dictionary, json_file):
# Записать словарь в виде файла json
with open(json_file, 'w', encoding='utf-8') as handler:
json.dump(dictionary, handler, ensure_ascii=False, sort_keys=True, indent=2)
def prettify_json(source, outname):
initial = load_json(source)
dump_json(initial, outname)
print('DONE')
if __name__ == '__main__':
source = r"egrul_status.json"
output = r"egrul_status.json"
prettify_json(source, output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment