Proxy Community
How to Use json.dumps Without Newlines in a Dictionary for Compact Output? - Printable Version

+- Proxy Community (https://proxycommunity.com/forum)
+-- Forum: Technical Community Support (https://proxycommunity.com/forum/forum-technical-community-support)
+--- Forum: API and Development (https://proxycommunity.com/forum/forum-api-and-development)
+--- Thread: How to Use json.dumps Without Newlines in a Dictionary for Compact Output? (/thread-how-to-use-json-dumps-without-newlines-in-a-dictionary-for-compact-output)

Pages: 1 2 3


“” - invisibleHawk77 - 16-03-2025

I’ve been using `json.dumps(my_dict, separators=(',', ':'))` for years. It’s the most efficient way to get json dumps without newlines in a dictionary. If you’re working with APIs, Postman also has a “raw” JSON mode that strips out all formatting.


“” - dataNomadX - 16-03-2025

Thanks for the tip! I was struggling with this too. For json dumps without newlines in a dictionary, your solution is perfect. I also found that using `json.dumps(my_dict, indent=None)` works similarly. For quick JSON validation, I use [jsonformatter.curiousconcept.com](https://jsonformatter.curiousconcept.com).