title: Fetch POST ReactJs to Controller .Net Core
body: <p>I have problem in Fetch POST to controller, an showing error like <code>{"errors":{"":["Unexpected character encountered while parsing number: W. Path '', line 1, position 6."]},"title":"One or more validation errors occurred.","status":400,"traceId":"0HLOGKVEBUTKL:00000007"}</code>. When I debbug too, in my controller it's not passing to controller. </p>
  
  <p>This what I POST to</p>
  
  <p><a href="https://i.stack.imgur.com/QG8NO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QG8NO.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/VonsN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VonsN.png" alt="enter image description here"></a></p>
  
  <p>I'm using ReactJs for client-side, and Net Core for server-side. Here my code snippet:</p>
  
  <p>AddList.js</p>
  
  <pre><code> fetch('api/SampleData/AddEmployee', {
     method: 'POST',
     headers: {
       'Accept': 'application/json; charset=utf-8',
       'Content-Type': 'application/json;charset=UTF-8'
     },
     body: data,
   }).then((response) =&gt; response.json())
   .then((responseJson) =&gt; {
     console.log('Success:', JSON.stringify(responseJson));
     this.props.history.push("/list-data");
   })
     .catch(error =&gt; console.error('Error:', error));
  </code></pre>
  
  <p>SampleDataController.cs</p>
  
  <pre><code>[HttpPost("[action]")]
  public JsonResult AddEmployee(EmployeesViewModel employee)
  {
  }
  </code></pre>
  
  <p>starrup.cs</p>
  
  <pre><code> app.UseMvc(routes =&gt;
   {
     routes.MapRoute(
       name: "default",
       template: "{controller}/{action=Index}/{id?}");
  
     routes.MapRoute(
       name: "api",
       template: "api/{controller}/{action}/{id?}");
   });
  </code></pre>