How to put JSON data into a dictionary Python – what's the best way? or Struggling with how to put JS

14 Replies, 1357 Views

hey! for how to put json data into a dictionary python, here’s the deal:

- `json.loads()` for strings
- `json.load()` for files

example with a file:
```python
import json

with open('data.json') as f:
my_dict = json.load(f)
```

also, if you’re unsure about your json structure, print it out first to see what you’re working with.

Messages In This Thread



Users browsing this thread: 1 Guest(s)