user1670407
user1670407

Reputation:

Laravel json response has back slashes

When I return just a profile like

return $profile->toJson();

The json string looks perfect but when I do

return Response::json(array('success' => 'true', 'profile' => $profile->toJson())); 

The profile part of the json string as all these backslashes before the quotes.

Upvotes: 2

Views: 1389

Answers (1)

AntonNiklasson
AntonNiklasson

Reputation: 1749

It seems to me that you are converting to JSON two times. Try this:

return Response::json(array('success' => 'true', 'profile' => $profile));

Upvotes: 2

Related Questions