How to return a foreach inside a shortcode

As I said in the comment you can use buffering like this

function stock_agenda() {
    $days = json_decode(file_get_contents('json_file'));
    unset($days[0]);
    ob_start(); // start buffer
    ?>
    <table class="table">
        <thead>
            <tr>
                <th> Title </th>
                <th>Content</th>
                <th>Date</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach($days as $day) { ?>
            <tr>
                <td><?php echo $day[0]; ?></td>
                <td><?php echo $day[1]; ?></td>
                <td><?php echo $day[2]; ?></td>
            </tr>
            <?php } ?>
        </tbody>
    </table>
    <?php
    $output = ob_get_clean(); // set the buffer data to variable and clean the buffer
    return $output;
}