I always wondered how some of the BBEdit features (like Text Filters) worked.

The model of operation is quite simple:

bbedit menu with this text filter

I open up a JSON file and run this option, to have it neatly formatted. VoilĂ !

#!/usr/bin/env python3
JSON Format.py
This BBEdit TextF Filter formats a json file in the bbedit buffer 
using python's json module

Pradeep Gowda

import json
import sys

text = sys.stdin.read()
print(json.dumps(json.loads(text), indent=2))

Commit the ~/Library/Application Support/BBEdit/ directory to git and you can use them from different mac machines running BBEdit:

cd ~/Library/Application Support/BBEdit/
git init 
git push ..blah..

You may want to exclude the Notes.bbnotebookd directory which contains the “Notes”s.

See also: BBEdit, and jsonfmt