I don't know what causes the problem, but below is the original PHP code which resulted with the wanted JSON format:
PHP
return response()->json($model->things, 200);
JSON
[
    {...},
    {...},
    ...
]
However, when I sorted the collection, the array in JSON became an object.
PHP
return response()->json($model->things->sortBy("name"), 200);
JSON
{
    "0": {...},
    "1": {...},
    ...
}
Did I do something wrong? I tried dding the collection in the 2 cases, but the results look the same to me.
 
    