title: Ajax POST and Stringify Confusion
body: <p>I am learning about POST with Ajax and I've noticed a lot of examples using stringify on static arrays.</p>
  
  <p>In my example I am building array via jQuery objects extracted from <code>&lt;input&gt;</code> values.</p>
  
  <h2>Jquery</h2>
  
  <pre><code>    function PostEdit(vData){
          var content = JSON.stringify(vData); //content = "[{"Id":"1","Date":"7/12/2017 12:00:00 AM"}]"
  
              $.ajax({
                  url: '@Url.Action("Index", "PostViewData")',
                  type: "POST",
                  data: JSON.stringify({ ViewData : vData }),
                  contentType: "application/json",
                  success: function (result) {
                      alert("success" + result);
                  },
                  error: function (result) {
                      alert("failure" + result);
                  }
          });
          return;
      }
  </code></pre>
  
  <h2>Controller</h2>
  
  <pre><code>    [HttpPost]
      public ActionResult Index(List&lt;DataViewModel&gt; ViewData )
      {
          if(ViewData != null)
          {
              var json = new { success = true };
              return Json(json);
          }
          return Json(false);
      }
  </code></pre>
  
  <h2>ViewModel</h2>
  
  <pre><code>public class DataViewModel
  {
      public DataViewModel(string id, string date)
      {
          Id = id;
          Date = date;
      }
      public string Id { get; set; }
      public string Date { get; set; }
  }
  </code></pre>
  
  <p>Where <code>DataViewModel</code> is a class that consists of two values, <code>Id</code>, and <code>Date</code> which correspond to my JS object.</p>
  
  <p>Since <code>vData</code> enters the function as value <code>vData = [Object]</code>, When I call <code>.stringify(vData)</code> it returns <code>content = "[{"Id":"1","Date":"7/12/2017 12:00:00 AM"}]"</code></p>
  
  <p>The value of <code>content</code> above is how I see most examples structured before stringify such as the example <a href="https://stackoverflow.com/questions/11109795/how-do-i-post-an-array-of-objects-with-ajax-jquery-or-zepto">here</a>.</p>
  
  <p>Once in this format, this is when most responses, examples call stringify anyway.</p>
  
  <p>Now when I call <code>.stringify(ViewData : vData)</code> I dont even make it to the controller. Ajax fails to post. On the contrary when I call <code>.stringify(ViewData : content)</code>, I make it to the controller, but with a null value. What am I missing / misunderstanding? </p>
  
  <p>I'm looking for a better explanation of Ajax Post and Stringify, and how it interacts with the controller parameter.</p>