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

22 Replies, 1976 Views

Oh man, I feel you on this. The default formatting in `json.dumps` can be a pain. Your fix works great, but if you want to avoid messing with separators, you can also use `json.dumps(my_dict, indent=None)`. It’s a bit less verbose and still gives you json dumps without newlines in a dictionary.

Messages In This Thread



Users browsing this thread: 1 Guest(s)