Skip to content

Instantly share code, notes, and snippets.

@chales
Last active April 26, 2024 20:55
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chales/510c5bed59a32ed0cb55 to your computer and use it in GitHub Desktop.
Save chales/510c5bed59a32ed0cb55 to your computer and use it in GitHub Desktop.
Make JSON legible with BBEdit
2016/03/15
Tested with BBEdit 11.5 / OS X 10.11.3 / Python 2.7.10
http://grokin.gs/blog/elegant-json-pretty-print-for-bbedit/
Place the script (or a link to this script) in the ~/Library/Application Support/BBEdit/Text Filters directory
Restart BBEdit.
The new filter should be under: "Test > Apply Text Filter > bbedit-pretty-json"
#!/bin/bash
python -c "import sys, json; print json.dumps(json.load(sys.stdin), indent=2)"
@michaldobisek
Copy link

If you have jq installed (which could be simply done via homebrew brew install jq), then the Format JSON filter could be as simple as

#!/bin/bash
jq .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment