def convert(name: str) ->str:
    """Convert path name into valid JSON.

    Parameters
    ----------
    name : str
        a path name

    Returns
    -------
    str
        valid JSON path

    """
    if '-' in name or ' ' in name:
        return '["{}"]'.format(name[1:])
    return name
