Wait, is your file *actually* empty or just *seems* empty? If you’re opening it in a text editor right after running, some editors (looking at you, VS Code) don’t auto-refresh. Try reopening it manually.
Also, json.dump won’t complain if your data’s valid but your file handle’s borked. Always double-check:
```python
with open('data.json', 'w') as f:
json.dump({"test": 123}, f)
f.flush() # Force write!
```
If that works, your original data’s the culprit.
Also, json.dump won’t complain if your data’s valid but your file handle’s borked. Always double-check:
```python
with open('data.json', 'w') as f:
json.dump({"test": 123}, f)
f.flush() # Force write!
```
If that works, your original data’s the culprit.
