Created
October 23, 2013 08:50
-
-
Save auramo/7114970 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 json | |
import fileinput | |
def compact(raw): | |
parsed = json.loads(raw) | |
compacted = json.dumps(parsed, separators=(',',':')) | |
return compacted | |
def read_from_input(): | |
lines = [] | |
for line in fileinput.input(): | |
lines.append(line.rstrip('\n')) | |
return ''.join(lines) | |
raw = read_from_input() | |
compacted = compact(raw) | |
print compacted | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment