Hacker News
Using jq to format JSON on the clipboard
The article shows how to create a shell alias that reads JSON from the clipboard, pretty-prints it with jq, and writes the result back, using pbcopy/pbpaste on macOS or xclip on Linux. It adds error handling so that if the clipboard contents are not valid JSON, the original text is preserved instead of being replaced with an empty string.