Category: json

Problem

Serialize Python objects to formatted JSON.

Solution

  Path("out.json").write_text(json.dumps(data, indent=2))
  

Notes

  • Adapt variable names and paths to your project
  • Add error handling for production use
  • See related chapters in the Learning Path