def METHOD_NAME(license):
    """Converts a LicenseInfo to JSON.
    Args:
        license: a LicenseInfo
    Returns:
        JSON representation of license.
    """
    kinds = []
    for kind in sorted(license.license_kinds, key = lambda x: x.name):
        kinds.append(_kind_template.format(
            kind_name = kind.name,
            kind_path = kind.label,
            kind_conditions = kind.conditions,
        ))
    return _license_template.format(
        copyright_notice = license.copyright_notice,
        kinds = ",".join(kinds),
        license_text = license.license_text.path,
        package_name = license.package_name,
        package_url = license.package_url,
        package_version = license.package_version,
        label = _strip_null_repo(license.label),
        bazel_package = _bazel_package(license.label),
    )