def prettify(jsonobj, prettify=True):
 if (not prettify):
  return json.dumps(jsonobj)
 json_str = json.dumps(jsonobj, indent=2, sort_keys=True)
 if pygments:
  try:
   lexer = get_lexer_for_mimetype('application/json')
   return pygments.highlight(json_str, lexer, TerminalFormatter())
  except:
   pass
 return json_str

def prettify ( jsonobj , prettify = True ) : if ( not prettify ) : return json . dumps ( jsonobj ) json_str = json . dumps ( jsonobj , indent = 2 , sort_keys = True ) if pygments : try : lexer = get_lexer_for_mimetype ( 'application/json' ) return pygments . highlight ( json_str , lexer , TerminalFormatter ( ) ) except : pass return json_str
prettiffy json output .