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.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6