Source code for now.thirdparty.PyInquirer.utils

# -*- coding: utf-8 -*-
import json

__version__ = '0.1.2'


[docs]def format_json(data): return json.dumps(data, sort_keys=True, indent=4)
[docs]def colorize_json(data): try: from pygments import formatters, highlight, lexers if isinstance(data, bytes): data = data.decode('UTF-8') colorful_json = highlight( data, lexers.JsonLexer(), formatters.TerminalFormatter() ) return colorful_json except ModuleNotFoundError: return data