I have below transformer which works but there is unnecessary array in the response.
class NamedayTransformer extends TransformerAbstract
{
public function transform(Nameday $nameday)
{
return [
'nameday' => $nameday->name,
'day' => $nameday->day,
'month' => $nameday->month,
];
}
}
This is the response
{
"data": [
{
"nameday": "FrantiĊĦek",
"day": 4,
"month": 10
}
]
}
I would prefer to have simple json instead of array IN json. Could you please recommend a solution?