How to Use json.dumps Without Newlines for Compact Output?

16 Replies, 2264 Views

Hey folks,

So I was messing around with json.dumps and noticed it adds newlines by default, which is kinda annoying when I want compact output.

Anyone know how to use json dumps without newlines? Like, I just want everything in one line, no extra spaces or breaks.

I tried `indent=None` and `separators=(',', ':')`, but still feels like I'm missing something.

Pls help a noob out!

Thx in advance Smile

P.S. If there's a better way to get json dumps without newlines, lmk!

Messages In This Thread
How to Use json.dumps Without Newlines for Compact Output? - by - 04-03-2024, 03:51 PM



Users browsing this thread: 1 Guest(s)