Skip to content

Instantly share code, notes, and snippets.

@sushihangover
Created May 8, 2016 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sushihangover/8e590f3fdcf674567b208071486ff014 to your computer and use it in GitHub Desktop.
Save sushihangover/8e590f3fdcf674567b208071486ff014 to your computer and use it in GitHub Desktop.
TextWranger Format Filter for Json (~/Library/Application Support/TextWrangler/Text Filters)
#!/usr/bin/python
import fileinput
import json
if __name__ == "__main__":
jsonStr = ''
for aline in fileinput.input():
jsonStr = jsonStr + ' ' + aline.strip()
jsonObj = json.loads(jsonStr)
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