I’ve been using `json.dumps(my_dict, separators=(',', ':'))` for ages now. It’s the simplest way to get json dumps without newlines in a dictionary. If you’re into CLI tools, `jq` is awesome for manipulating JSON from the terminal. Just pipe your output through `jq -c` for compact JSON.
How to Use json.dumps Without Newlines in a Dictionary for Compact Output?
22 Replies, 1696 Views| Messages In This Thread |
|
How to Use json.dumps Without Newlines in a Dictionary for Compact Output? - by - 12-02-2025, 06:25 AM
|
Users browsing this thread: 1 Guest(s)
