Laravel 5.4 sortBy()在作为JSON返回时不起作用

Gor*_*iev 6 php laravel

Laravel Doc

我的laravel版本const VERSION ='5.4.15';

HomeController的

$collection = collect([
    ['name' => 'Desk', 'price' => 200],
    ['name' => 'Chair', 'price' => 100],
    ['name' => 'Bookcase', 'price' => 150],
]);

$sorted = $collection->sortBy('price');

$sorted->values()->all();

return $sorted;
Run Code Online (Sandbox Code Playgroud)

以JSON格式返回时的结果:

{
     0: {
          name: "Desk",
          price: 200
     },
     1: {
          name: "Chair",
          price: 100
     },
     2: {
          name: "Bookcase",
          price: 150
     }
 }
Run Code Online (Sandbox Code Playgroud)

我错过了什么?为什么不sortBy工作?