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.2, Zend 3.0, Symfony 4.0, Laravel 5.6, PHPUnit 6.5, Doctrine 2.8