Reputation: 382
I'm trying to return an json object from controller's route
return new JsonResponse($result);
It returns
string(36) "e91a6865-b2a8-4b7d-9351-2eac29f7aa30"
{
//data
}
How can I get rid of the string(36) "e91a6865-b2a8-4b7d-9351-2eac29f7aa30"
?
Upvotes: 0
Views: 751
Reputation: 8374
a string(36) "e91a6865-b2a8-4b7d-9351-2eac29f7aa30"
or something similar, that wasn't added to the JsonResponse
, usually is caused by a stray var_dump
/dump
call somewhere in the code base (but in a part that gets evaluated).
Essentially what happens: the var_dump
/dump
is called and it produces the output, and afterwards the output from the Response object (be it the JsonResponse or some other Response) is appended to that.
Options to handle this:
grep -nr dump src
in the project root (on linux obviously, replace dump
by dd
if appropriate), this should find the relevant locations in code.However, overall it's a rather benign source of irritating output.
Upvotes: 1