Skip to content

Instantly share code, notes, and snippets.

@edenwaith
Created October 14, 2014 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edenwaith/7d374fc4db82ed34a83d to your computer and use it in GitHub Desktop.
Save edenwaith/7d374fc4db82ed34a83d to your computer and use it in GitHub Desktop.
TextWrangler Text Filter to Compact JSON (remove whitespace)
#!/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=False, separators=(',',':'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment