def generate_json(sourced_id, title, description, assign_date, due_date, class_sourced_id, category, result_value_max,result_value_min):
    """
    Generate a JSON formatted value ready to be sent to OpenLRW
    :param sourced_id:
    :param title:
    :param description:
    :param assign_date:
    :param due_date:
    :param class_sourced_id:
    :param category:
    :param result_value_max:
    :param result_value_min
    :return:
    """
    if result_value_max is None:
        result_value_max = 0.0

    if result_value_min is None:
        result_value_min = 0.0

    return {
        "sourcedId": sourced_id,
        "title": title,
        "description": description,
        "assignDate": assign_date,
        "dueDate": due_date,
        "resultValueMax": result_value_max,
        "resultValueMin": result_value_min,
        "class": {
            "sourcedId": class_sourced_id
        },
        "metadata": {
            "type": category
        }
    }