title: How To Fix SyntaxError: Unexpected token b in JSON at position 0
body: <p>I want to read an e-mail address as a string from my backend using Spring MVC. However, when I try to read it using Angular's <code>HttpClient</code>, I get the following error:</p>
  
  <pre><code>SyntaxError: Unexpected token b in JSON at position 0 at JSON.parse
  </code></pre>
  
  <p>This is a screenshot of the error displayed within the console:</p>
  
  <p><a href="https://i.stack.imgur.com/XcAOk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XcAOk.png" alt="Screenshot of console"></a></p>
  
  <p>This is the code I'm using in Angular to read the response:</p>
  
  <pre class="lang-ts prettyprint-override"><code>public findEmail(username: string): Observable&lt;string&gt; {
    let params = new HttpParams();
    params = params.append('username', username);
    return this.httpClient.get&lt;string&gt;(this.baseUrl + '/findEmail', {params});
  }
  </code></pre>
  
  <p>And this is the code of the Spring controller that provides the response:</p>
  
  <pre class="lang-java prettyprint-override"><code>@GetMapping(value = "/findEmail", params = { "username" })
  public String findEmail(@RequestParam String username) {
      return utilisateursService.findEmail(username);
  }
  </code></pre>