I discover that while my object is empty, and with the N+1 report for JsonResponse, my empty object will be converted to empty array.
In my production with debug is false will not be converted, this will be ok.
but in my development with debug is true, empty object will be converted to empty array, it's a problem.
example:
public function index()
{
$chapters = Chapter::where('book_id',1)->get();
$data = [];
$chapters->each(function (Chapter $chapter) use (&$data) {
$data['book_name'] = (string) $chapter->book->name;
$data['empty_object'] = (object) [];
});
return response()->json($data);
}
Hello,
I discover that while my object is empty, and with the N+1 report for JsonResponse, my empty object will be converted to empty array. In my production with debug is false will not be converted, this will be ok. but in my development with debug is true, empty object will be converted to empty array, it's a problem.
example:
my expectation output is
but output is
In Json.php with namespace BeyondCode\QueryDetector\Outputs
change to
will get my expectation output.