from typing import Union
import requests


def get_json(url: str, params: Union[list, dict, None] = None) -> Union[list, dict]:
    """
    Perform a GET request to a REST API endpoint, assume the response is a JSON
    """
    resp = requests.get(url, params=params)
    
    if not resp.ok:
        resp.raise_for_status()

    return resp.json()