Created
July 26, 2012 10:18
-
-
Save tomhennigan/3181359 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import simplejson | |
while True: | |
line = sys.stdin.readline() | |
if not line: | |
break | |
parts = line.split("\t") | |
formatted = [] | |
for part in parts: | |
try: | |
f = simplejson.dumps(simplejson.loads(part), sort_keys = False, indent = 4) | |
except: | |
f = part | |
formatted.append(f.rstrip("\n")) | |
print "\t".join(formatted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment