AshleyP
248
9
Laravel

response->json($array) giving out too much input and not just json?

Posted 3 months ago by AshleyP

Hi,

I'm hoping for a clean response using:

$authentication_array = ['api_token' => $token];
echo response()->json($authentication_array); 

Like so:

{"api_token":"n4dmXOAjWwmt3mOR"}

Instead I get this:

HTTP/1.0 200 OK Cache-Control: no-cache, private Content-Type: application/json Date: Fri, 12 Apr 2019 09:39:51 GMT {"api_token":"n4dmXOAjWwmt3mOR"}

Any idea what I need to edit?

Please sign in or create an account to participate in this conversation.