title: Ajax POST an object with javascript, but the value in backend is null, why?
body: <p>So on button click there is a function sendEmail(). Alert is working fine, I can see my datas there. But on backend I can't see anything, just everything is null.</p>
  <pre><code>   function sendEmail() {
          var datas = new Object();
          datas.mail = $('#contactDropdownList').val();
          datas.mailobject = $('#emailObject').val();
          datas.text = $('#emailText').val();enter code here
      
          alert(datas.mail + datas.mailobject + datas.text);
      
          $.ajax({
              type: &quot;POST&quot;,
              dataType: &quot;json&quot;,
              url: &quot;/Email/sendEmail&quot;,
              contentType: 'application/json; charset=UTF-8',
              data: JSON.stringify({ items: datas }),
              success: function (data) {
                  console.log(data);
                  //do something with data
              },
              error: function (jqXHR, textStatus, error) {
                  //log or alert the error
                  console.log(error);
              }
          });
      
      }
  </code></pre>
  <p>C# code:</p>
  <pre><code> public class MyClass
      {
          public string Email { get; set; }
          public string Object { get; set; }
          public string Text { get; set; }
  
      }
  
  [HttpPost]
  public IActionResult sendEmail(MyClass items)
  {
      return Json(new { data=&quot;Ok&quot; });
  }
  </code></pre>
  <p>items.Email, items.Object and items.Text are null.
  And the return valu is null as well, because in javascript success: function (data) { console.log(data);
  is empty string.</p>
  <p>What can be the problem? Thank you!</p>