async def convert_to_json(response):
    """ Converts the aiohttp ClientResponse object to JSON.

    :param response: The ClientResponse object.
    :raises: ValueError if the returned data was not of type application/json
    :returns: The parsed json of the response
    """
    if "Content-Type" in response.headers and "application/json" not in response.headers["Content-Type"]:
        raise ValueError("The response from {} does not have application/json mimetype".format(response.url))

    return await response.json()