Or on macOS, to quickly format the contents of your clipboard:
pbpaste | jq . | pbcopy
Pretty sure this is one of my most frequent commands. pbpaste | jq . | pbcopy
Pretty sure this is one of my most frequent commands.1. Start Automator.
2. In the "Choose a type..." sheet, choose "Quick Action".
3. Set these:
Workflow recieves "current text" in "any application".
Input is "entire selection". [X] Output replaces text.
4. Add "Run shell script" and select your preferred shell. jq .
(Note that Automator is handling your stdin / stdout.)5. File / Save.
You can now find your workflow by command-clicking the document name in the window's titlebar. It should be in /Users/You/Library/Services
Now, fire up TextEdit, enter some JSON. Right-click, select Services and your service should be present. It's also in the TextEdit menu under Services.