if you’re struggling with how to put json data into a dictionary python, here’s a pro tip:
use `json.loads()` for strings and `json.load()` for files.
example for a file:
```python
import json
with open('data.json', 'r') as file:
my_dict = json.load(file)
```
this automatically closes the file too, so no leaks. easy peasy!
use `json.loads()` for strings and `json.load()` for files.
example for a file:
```python
import json
with open('data.json', 'r') as file:
my_dict = json.load(file)
```
this automatically closes the file too, so no leaks. easy peasy!
