-
-
Save washt/0f45971664c59e4d797273c0e3bbe477 to your computer and use it in GitHub Desktop.
JSON Pretty Print Stream
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/python -u | |
import sys, json | |
from pygments import highlight | |
from pygments.lexers import JsonLexer | |
from pygments.formatters import Terminal256Formatter | |
while True: | |
line = sys.stdin.readline() | |
if line.strip(): | |
print highlight(json.dumps(json.loads(line.strip()), sort_keys=False, indent=4, separators=(',',': ')), JsonLexer(), Terminal256Formatter(style='paraiso-dark')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment