Skip to content

Instantly share code, notes, and snippets.

@lancetw
Created January 16, 2018 11:21
Show Gist options
  • Save lancetw/aaec36a70dcf05f90b6106f6a7d76dc8 to your computer and use it in GitHub Desktop.
Save lancetw/aaec36a70dcf05f90b6106f6a7d76dc8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pygments import highlight
from pygments.lexers import JsonLexer
from pygments.formatters import TerminalFormatter
from pprint import pformat
import json
def pprint_color(obj, indent=2):
print(highlight(json.dumps(obj, sort_keys=True, indent=indent, ensure_ascii=False), JsonLexer(), TerminalFormatter()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment