MCPcopy
hub / github.com/C2SP/wycheproof / reformat_json_file

Function reformat_json_file

tools/reformat_json.py:21–30  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

19
20
21def reformat_json_file(file_path):
22 with open(file_path, 'r', encoding='utf-8') as f:
23 content = f.read()
24
25 data = json.loads(content)
26 formatted_content = json.dumps(data, indent=2, separators=(',', ': '), ensure_ascii=False)
27
28 with open(file_path, 'w', encoding='utf-8') as f:
29 f.write(formatted_content)
30 f.write('\n')
31
32
33if __name__ == '__main__':

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected