import json


def parse_user_parameters(params_str):
    """Parses a given UserParameters string.

    A UserParameters string must be a JSON object.

    :type params_str: str
    :param params_str: UserParameters string to be parsed.

    :rtype: dict
    :return: parsed user parameters.

    :raises JSONDecodeError: if ``params_str`` is not a valid JSON text.

    :raises ValueError: if ``params_str`` is not a JSON object.
    """
    params = json.loads(params_str)
    if not isinstance(params, dict):
        raise ValueError(f'UserParameters must be a JSON object not {type(params)}')
    return params