from typing import AnyStr
import json


def load_json_dict(text: AnyStr) -> dict:
    """Loads from JSON and checks that the result is a dict.

    Raises
    ------
    ValueError
        if `text` is not valid JSON or is valid JSON but not a dict
    """
    ans = json.loads(text)
    if not isinstance(ans, dict):
        raise ValueError('not a dict')
    return ans