title: ASP.NET MVC How to pass JSON object from View to Controller as Parameter
body: <p>I have a complex JSON object which is sent to the View without any issues (as shown below) but I cannot work out how Serialize this data back to a .NET object when it is passed back to the controller through an AJAX call. Details of the various parts are below.</p>
  
  <pre><code>   var ObjectA = {
          "Name": 1,
          "Starting": new Date(1221644506800),
  
          "Timeline": [
              {
                  "StartTime": new Date(1221644506800),
                  "GoesFor": 200
  
              }
              ,
              {
                  "StartTime": new Date(1221644506800),
                  "GoesFor": 100
  
              }
  
          ]
      };
  </code></pre>
  
  <p>I am not sure how this object can be passed to a Controller Method, I have this method below where the Timelines object mirrors the above JS object using Properties.</p>
  
  <pre><code>public JsonResult Save(Timelines person)
  </code></pre>
  
  <p>The jQuery I am using is:</p>
  
  <pre><code>        var encoded = $.toJSON(SessionSchedule);
  
          $.ajax({
              url: "/Timeline/Save",
              type: "POST",
              dataType: 'json',
              data: encoded,
              contentType: "application/json; charset=utf-8",
              beforeSend: function() { $("#saveStatus").html("Saving").show(); },
              success: function(result) {
                  alert(result.Result);
                  $("#saveStatus").html(result.Result).show();
              }
          });
  </code></pre>
  
  <p>I have seen this question which is similar, but not quite the same as I am not using a forms to manipulate the data.
  <a href="https://stackoverflow.com/questions/267707/how-to-pass-complex-type-using-json-to-asp-net-mvc-controller">How to pass complex type using json to ASP.NET MVC controller</a></p>
  
  <p>I have also seen references to using a 'JsonFilter' to manually deserialize the JSON, but was wondering if there is a way to do it nativly though ASP.NET MVC? Or what are the best practices for passing data in this way?</p>