Laravel json的反应有反斜杠

时间:2014-03-16 18:39:30

标签: json laravel

当我返回一个像

这样的个人资料时
return $profile->toJson();

json字符串看起来很完美但是当我做

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

json字符串的配置文件部分,作为引号之前的所有这些反斜杠。

1 个答案:

答案 0 :(得分:1)

在我看来,您正在转换为JSON两次。试试这个:

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