def ppjson(dumpit: Any, elide_to: int = None) -> str:
    """
    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
    """

    if elide_to is not None:
        elide_to = max(elide_to, 3) # make room for ellipses '...'
    try:
        rv = json.dumps(json.loads(dumpit) if isinstance(dumpit, str) else dumpit, indent=4)
    except TypeError:
        rv = '{}'.format(pformat(dumpit, indent=4, width=120))
    return rv if elide_to is None or len(rv) <= elide_to else '{}...'.format(rv[0 : elide_to - 3])
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