You are setting the entire $kurse
array as the 'kurse'
value. If you want the 2nd output, then you need to format your PHP array correctly. As shown, your PHP code creates the JSON shown in the 1st example.
If you want the 2nd example, then you need to do something like this:
$ausgabe = array_map(function($a, $b){
return array(
'kurse' => $a,
'test' => $b
);
}, $kurse, $test);