Instantly share code, notes, and snippets.

What would you like to do?
TextWrangler Text Filter to Compact JSON (remove whitespace)
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