4 ms·
python -m json.tool seems neat. I am always dumping JSON in single log lines and then expanding it to diff it (currently using Cmd+Opt+L in PyCharm).
by Noumenon72 3y ago
python -m json.tool seems neat. I am always dumping JSON in single log lines and then expanding it to diff it (currently using Cmd+Opt+L in PyCharm).
- dmurray 3y agoI tend to use "jq .". An extra tool, but you don't really have to learn it, and if you're "always dumping JSON" and also use the command line a lot, you probably want to have it around anyway.
- OJFord 3y agoYou don't need the `.` fwiw, just `produce-compact-json | jq` will do.
- rich_sasha 3y agoNot always, some versions of jq get confused without the dot. I work on two Linuces at work, one requires it and one doesn't.
- OJFord 3y agoThe current version and for quite some time, then. If I said 'Windows comes with the Edge browser' would you say 'I use two at work, one does but the other only has Internet Explorer'? Surely it's generally implied we're talking about things as they are, unless specified otherwise?
- cl3misch 3y agoFYI, you can also just pipe into "jq". If anything it's faster to type :-)