json.dump python is easy-peasy once you avoid the traps. Example:
```python
import json
stuff = {"key": "value"}
with open("stuff.json", "w") as f:
json.dump(stuff, f)
```
Empty file? Probably a permission issue or the file’s already open elsewhere.
Indent is purely cosmetic—makes the json pretty. Use it if you’re sharing the file or debugging.
For complex data, check out `json.JSONEncoder` or convert to strings first.
```python
import json
stuff = {"key": "value"}
with open("stuff.json", "w") as f:
json.dump(stuff, f)
```
Empty file? Probably a permission issue or the file’s already open elsewhere.
Indent is purely cosmetic—makes the json pretty. Use it if you’re sharing the file or debugging.
For complex data, check out `json.JSONEncoder` or convert to strings first.
