SHARE
TWEET

JSON formatter for TextWrangler

priore Jan 16th, 2014 131 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top