//Пример
$content = ['test' => ['one' => 1], ['two' => ['test'] => 1]];
return Response::json($content, 200, ['Content-type'=> 'application/json; charset=utf-8'], JSON_UNESCAPED_UNICODE);
{test": {"one": 1}, {"two": {"test": 1}}
{
test": {
"one": 1
},
{
"two": {
"test": 1
}
}
public function action(): array
{
return ['test' => ['one' => 1], ['two' => ['test'] => 1]];
}
public function handle(Request $request, \Closuse $next)
{
$response = $next($request);
if (\config('app.debug') && $response instanceof JsonResponse) {
$response->setEncodingOptions($response->getEncodingOptions() | \JSON_PRETTY_PRINT);
}
return $response;
}