Advertisement
priore

JSON formatter for TextWrangler

Jan 16th, 2014
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. # put script in ~/Library/Application Support/TextWrangler/Text Filters/Format JSON.py
  2. #!/usr/bin/python
  3. import fileinput
  4. import json
  5. if __name__ == "__main__":
  6.   text = ''
  7.   for line in fileinput.input():
  8.     text = text + ' ' + line.strip()
  9.   jsonObj = json.loads(text)
  10.   print json.dumps(jsonObj, sort_keys=True, indent=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement