Strip comma from last element in concatenated JSON string

Mixing up code of different languages is not a good practice. Further, building a JSON format as kind of a template is not necessary. You can build your data structure and then format it to a valid JSON string using json_encode():

 <?php
if ( have_rows( 'breadcrumb' ) ) {

    $json_data = [
        "@context"        => "http://schema.org",
        "@type"           => "BreadcrumbList",
        "itemListElement" => []
    ];

    while ( have_rows( 'breadcrumb' ) ) {
        the_row();

        // vars
        $position = get_sub_field( 'position' );
        $name     = get_sub_field( 'name' );
        $url      = get_sub_field( 'url' );

        $json_data[ 'itemListElement' ][] = [
            "@type"    => "ListItem",
            "position" => $position,
            "item"     => [
                "@id"  => $url,
                "name" => $name
            ]
        ];
    }

    $json_string = json_encode( $json_data );
    $html_script = <<<HTML
<script type="application/json">{$json_string}</script>
HTML;

    echo $html_script;
}

I assume that this code is in some kind of template file, as you directly print the results. You should consider to separate your business logic (building your data structure) from the presentation/formatting of your data, as this makes the code more readable and maintainable.