What's the best way to read in a JSON file using Python? or How do I properly read in a JSON file wit

18 Replies, 1575 Views

Don’t overcomplicate it—your original code is perfect for most use cases. `json.load()` is the simplest way to python read in json file.

`pathlib` is nice but only worth it if you’re doing a lot of path manipulation. Otherwise, `open()` is just fine.

Side note: always validate your json with a tool like [JSONLint](https://jsonlint.com/) if things go sideways.

Messages In This Thread



Users browsing this thread: 1 Guest(s)