def ppjson(dumpit: Any, elide_to: int = None) -> str:
if elide_to is not None:<EOL><INDENT>elide_to = max(elide_to, <NUM_LIT:3>) <EOL><DEDENT>try:<EOL><INDENT>rv = json.dumps(json.loads(dumpit) if isinstance(dumpit, str) else dumpit, indent=<NUM_LIT:4>)<EOL><DEDENT>except TypeError:<EOL><INDENT>rv = '<STR_LIT:{}>'.format(pformat(dumpit, indent=<NUM_LIT:4>, width=<NUM_LIT>))<EOL><DEDENT>return rv if elide_to is None or len(rv) <= elide_to else '<STR_LIT>'.format(rv[<NUM_LIT:0> : elide_to - <NUM_LIT:3>])<EOL>
JSON pretty printer, whether already json-encoded or not

:param dumpit: object to pretty-print
:param elide_to: optional maximum length including ellipses ('...')
:return: json pretty-print