Yo, I had the same issue last week! The trick is to set `indent=None` AND `separators=(',', ':')` together.
Here’s the code snippet:
```python
import json
compact_json = json.dumps({"foo": "bar"}, indent=None, separators=(',', ':'))
print(compact_json)
```
This will give you json dumps without newlines, all in one line. If you’re still seeing newlines, maybe your IDE or terminal is adding them?
Here’s the code snippet:
```python
import json
compact_json = json.dumps({"foo": "bar"}, indent=None, separators=(',', ':'))
print(compact_json)
```
This will give you json dumps without newlines, all in one line. If you’re still seeing newlines, maybe your IDE or terminal is adding them?
