JsonResponse - Symfony has a lot of different Response classes

Code
<?php

use Symfony\Component\HttpFoundation\JsonResponse;

// use fitting Symfony response classes
$data = [
    
'data' => ['foo''bar''key' => 'value']
];
$response = new JsonResponse($data);
$response->sendContent();
Result
{"data":{"0":"foo","1":"bar","key":"value"}}
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8