from typing import Union
import requests


def post_json(url: str, data: Union[list, dict]) -> Union[list, dict]:
    """
    Send a POST request to the resource with the payload as JSON
    """
    resp = requests.post(url, json=data)
    
    if not resp.ok:
        resp.raise_for_status()
        
    return resp.json()