Skip to content

Instantly share code, notes, and snippets.

@howie
Forked from edenwaith/Format JSON.py
Last active August 29, 2015 14:26
Show Gist options
  • Save howie/d3aadc2eb376f42c25b5 to your computer and use it in GitHub Desktop.
Save howie/d3aadc2eb376f42c25b5 to your computer and use it in GitHub Desktop.
TextWrangler Text Filter to Format JSON
#!/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, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment