Here’s a quick example for json.dump python:
```python
import json
my_data = {"fruit": "apple", "count": 3}
with open("output.json", "w") as f:
json.dump(my_data, f, indent=2) # indent=2 for cleaner output
```
The `indent` param is just for readability—no functional impact. If your file’s empty, you might be writing to the wrong directory or not closing the file properly.
Try printing `my_data` first to ensure it’s valid. If it’s not a basic type, json.dump will fail silently.
```python
import json
my_data = {"fruit": "apple", "count": 3}
with open("output.json", "w") as f:
json.dump(my_data, f, indent=2) # indent=2 for cleaner output
```
The `indent` param is just for readability—no functional impact. If your file’s empty, you might be writing to the wrong directory or not closing the file properly.
Try printing `my_data` first to ensure it’s valid. If it’s not a basic type, json.dump will fail silently.
