On this page
article
Read JSON File
Load and parse JSON from disk with error handling.
Category: json
Problem
Load and parse JSON from disk with error handling.
Solution
data = json.loads(Path("config.json").read_text())
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path