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 7.3, Zend 3.0, Symfony 4.3, Laravel 5.8, PHPUnit 8.0, Doctrine 2.10