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

14 Replies, 1303 Views

hey! json.loads() is def the way to go for how to put json data into a dictionary python.

if your json is in a file, you gotta open it first, then use json.load() (not loads). here’s a quick example:

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

super simple! loads() is for strings, load() is for files. hope that helps!

Messages In This Thread



Users browsing this thread: 1 Guest(s)