title: Response.data returning json data as string Laravel 8/Axios
body: <p>In my laravel controller i'm returning a response as below</p>
  <pre><code>return response()-&gt;json([
                  'name' =&gt; 'Abigail',
                  'state' =&gt; 'CA',
              ], 400);
  </code></pre>
  <p>When i make a call from a browser using Axios the data I get back is showing the json object as a string</p>
  <p><a href="https://i.stack.imgur.com/auomh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/auomh.png" alt="enter image description here" /></a></p>
  <p>doing json.parse(response.data) also returns <code>Unhandled Rejection (SyntaxError): Unexpected token   in JSON at position 0</code></p>
  <p>I'm using Laravel 8</p>
  <p>the content-type is application/json and so is accept.
  Is there something that needs to be included?</p>
  <p>For the Axios call i have a class called User which contains this static login method <a href="https://i.stack.imgur.com/iuZGU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iuZGU.png" alt="enter image description here" /></a></p>
  <p>The login method is then called inside another file
  <a href="https://i.stack.imgur.com/HfrtT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HfrtT.png" alt="enter image description here" /></a></p>