Skip to content

Instantly share code, notes, and snippets.

@levigroker
Last active July 21, 2025 14:57
Show Gist options
  • Save levigroker/3777091 to your computer and use it in GitHub Desktop.
Save levigroker/3777091 to your computer and use it in GitHub Desktop.
BBEdit Text Filter to "pretty print" JSON
#!/bin/bash
# JSON Format - BBEdit Text Filter to "pretty print" JSON
# https://gist.github.com/levigroker/3777091
# 2023-11-16
JQ_E="jq"
which "$JQ_E" >/dev/null 2>&1
[ $? == 0 ] || { echo "ERROR: Please ensure '$JQ_E' is installed. 'brew install $JQ_E' (see https://jqlang.github.io/jq/ )" >&2; exit 1; }
$JQ_E --sort-keys --tab .
@martinburch
Copy link

As of BBEdit 14.0, rather than this custom filter, you can use BBEdit's own built-in module.

Added JSON formatting support to the factory-supplied JSON language module. Choose "Reformat Document" from the Text menu to reformat the document's text.

https://www.barebones.com/support/bbedit/notes-14.0.html

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