how to print output in json format python code example Example: python format json file Click to copypython3 -m json.tool unformatted.json > formatted.json