Skip to content

Instantly share code, notes, and snippets.

@thiagophx
Created March 17, 2015 18:42
Show Gist options
  • Select an option

  • Save thiagophx/9d6b06891a1ce3c707a7 to your computer and use it in GitHub Desktop.

Select an option

Save thiagophx/9d6b06891a1ce3c707a7 to your computer and use it in GitHub Desktop.

Revisions

  1. thiagophx created this gist Mar 17, 2015.
    11 changes: 11 additions & 0 deletions pp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    #!/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'))