open json pretty print code example
Example 1: pretty json python
print(json.dumps(dict, indent=4))
Example 2: python format json file
python3 -m json.tool unformatted.json > formatted.json
print(json.dumps(dict, indent=4))
python3 -m json.tool unformatted.json > formatted.json