Pretty print JSON data.

    Parameters
    ----------
    data
        JSON data.
    indent : `int`, optional
        Indent level in characters (default: 0).
    end : `str`, optional
        String to print after the data (default: '\\\\n').

def pprint(data, indent=0, end='\n'):
    """Pretty print JSON data.

    Parameters
    ----------
    data
        JSON data.
    indent : `int`, optional
        Indent level in characters (default: 0).
    end : `str`, optional
        String to print after the data (default: '\\\\n').
    """
    if isinstance(data, dict):
        print('{')
        new_indent = indent + 4
        space = ' ' * new_indent
        keys = list(sorted(data.keys()))
        for i, k in enumerate(keys):
            print(space, json.dumps(k), ': ', sep='', end='')
            pprint(data[k], new_indent,
                   end=',\n' if i < len(keys) - 1 else '\n')
        print(' ' * indent, '}', sep='', end=end)
    elif isinstance(data, list):
        if any(isinstance(x, (dict, list)) for x in data):
            print('[')
            new_indent = indent + 4
            space = ' ' * new_indent
            for i, x in enumerate(data):
                print(space, end='')
                pprint(x, new_indent,
                       end=',\n' if i < len(data) - 1 else '\n')
            print(' ' * indent, ']', sep='', end=end)
        else:
            print(json.dumps(data), end=end)
    else:
        print(json.dumps(data), end=end)