Skip to content

Instantly share code, notes, and snippets.

@priore
Created January 18, 2014 20:49
Show Gist options
  • Save priore/8496208 to your computer and use it in GitHub Desktop.
Save priore/8496208 to your computer and use it in GitHub Desktop.
JSON formatter for TextWrangler
# put script in ~/Library/Application Support/TextWrangler/Text Filters/Format JSON.py
#!/usr/bin/python
import fileinput
import json
if __name__ == "__main__":
text = ''
for line in fileinput.input():
text = text + ' ' + line.strip()
jsonObj = json.loads(text)
print json.dumps(jsonObj, sort_keys=True, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment