def parse_builder_url(url):
    """Parse a builder URL into buildbot URL and builder name."""
    # make sure trailing slashes don't cause failures
    url = url.rstrip('/').split('/')
    cut_index = url.index('builders')
    json_url = '/'.join(url[:cut_index] + ['json'] + url[cut_index:])
    return json_url