Hey folks,
So I was messing around with Python and trying to figure out how to use json dumps without newlines in a dictionary. Like, I want my JSON output to be compact, no extra spaces or line breaks, ya know?
I tried `json.dumps(my_dict)` but it adds all these newlines and indents by default. Annoying, right?
Turns out, you can just do `json.dumps(my_dict, separators=(',', ':'))` and it squishes everything together. No extra fluff!
Anyone else run into this? Or got a better way to get json dumps without newlines in a dictionary?
Thx in advance!
- A confused coder
So I was messing around with Python and trying to figure out how to use json dumps without newlines in a dictionary. Like, I want my JSON output to be compact, no extra spaces or line breaks, ya know?
I tried `json.dumps(my_dict)` but it adds all these newlines and indents by default. Annoying, right?
Turns out, you can just do `json.dumps(my_dict, separators=(',', ':'))` and it squishes everything together. No extra fluff!
Anyone else run into this? Or got a better way to get json dumps without newlines in a dictionary?
Thx in advance!
- A confused coder
