title: How to send fetch api request with object parameter with Angular?
body: <p>I try to send a user object in json format to backend and I get username, password, email etc. at backend from the parameter.
  Here is my backend code:</p>
  <pre><code>@PostMapping(&quot;/login&quot;)
      public User loginUser(@RequestBody User user) throws Exception {
          User userObj = null;
          if (!isNull(user.getEmail()) &amp;&amp; !isNull(user.getPassword())) {
              userObj = userService.getUserByEmailAndPassword(user);
          }
          if (isNull(userObj)) {
              throw new Exception(&quot;Bad credentials&quot;);
          }
          return userObj;
      }
  </code></pre>
  <p>As you see I am not sending string parameters, I am sending the whole object.</p>
  <p>In frontend,
  my component code is:</p>
  <pre><code>async loginUser(user:User) {
     let response = await this._service.LoginUser(user);
     let data = response.json();
     console.log(data);
   }
  </code></pre>
  <p>and this code is calling the following method from the service class,</p>
  <pre><code>LoginUser(user: User) {
      var url = new URL&quot;http://localhost:8080/login&quot;);
      var params =[[user]];
      url.search = new URLSearchParams(user).toString;
      return fetch(&quot;http://localhost:8080/login&quot;, user)
    }
  </code></pre>
  <p>But there is something wrong about sending request with parameter <strong>user</strong>. How can I make this request?(without using Jquery)</p>