`pathlib` vs `open()` is mostly preference. I like `pathlib` because it’s more modern, but `open()` is fine too.
For python read in json file, your code is correct. Just remember to handle exceptions—files might not always exist!
```python
try:
with open('data.json') as f:
data = json.load(f)
except FileNotFoundError:
print("Oops, file missing!")
```
For python read in json file, your code is correct. Just remember to handle exceptions—files might not always exist!
```python
try:
with open('data.json') as f:
data = json.load(f)
except FileNotFoundError:
print("Oops, file missing!")
```
