Python public recipes
The code opens the file "filename.json" in "w" mode, writes the JSON content to the file, and indents the code two spaces.
Shortcut: json.write.tofile
import json
with open("filename", "w") as f:
f.write(json.dumps("json_content", indent=2))