.NET MVC jQuery AJAX - JSON object as parameter not serializing values
<p>I'm trying to figure out how to simply pass a JSON object into a controller method param. I'll often use JSON.serialize() when posting forms and the serialization to C# is automatic. However, I'm struggling to get this to work using GET while trying to load a partial.</p>

<p>I built a small sample project as a basic simulation of what I need, which is a controller method that accepts an int param and a separate model class, which I'd like to pass in as JSON. The partial html response is loaded into a div.</p>

<p>The view:</p>

<pre><code>&lt;div class="row"&gt;
    Loading a partial via Ajax, passing a JSON object as a param!
&lt;/div&gt;
&lt;div class="row"&gt;
    &lt;div id="peoplePartial"&gt;&lt;/div&gt;
&lt;/div&gt;

@section Scripts {
    &lt;script&gt;
        $(function() {
            var id = 1;
            var person = {
                Name: "Homer Simpson",
                Age: 45
            };
            load(id, person);
        });

        function load(id, person) {
            $.ajax({
                cache: false,
                type: "GET",
                dataType: "html",
                url: '/Home/PeoplePartial',
                data: {
                    id: id,
                    person: JSON.stringify(person)
                }
            }).done(function(data) {
                $("#peoplePartial").html(data);
            }).fail(function(data) {
                console.log(data.responseText);
            });
        }
    &lt;/script&gt;
}
</code></pre>

<p>The partial:</p>

<pre><code>@model MVCLearning.Models.PeoplePartialModel

&lt;div&gt;
    &lt;span&gt;Person found! Name is @Model.Person.Name&lt;/span&gt;
&lt;/div&gt;
</code></pre>

<p>The partial ViewModel:</p>

<pre><code>public class PeoplePartialModel {
    public int Id { get; set; }
    public PersonModel Person { get; set; }
}
</code></pre>

<p>The data model/entity I'm trying to serialize:</p>

<pre><code>public class PersonModel {
    public string Name { get; set; }
    public int Age { get; set; }
}
</code></pre>

<p>And finally, the controller:</p>

<pre><code>public class HomeController : Controller {
    public ActionResult Index() {
        return View();
    }

    public ActionResult PeoplePartial(int id, PersonModel person) {
        if (person != null) {
            var model = new PeoplePartialModel {
                Id = id,
                Person = person
            };
            return PartialView("_People", model);
        } else {
            throw new System.Exception("An Error Has occoured");
        }
    }
}
</code></pre>

<p>The "id" param always works, of course, but the PeopleModel param is always null when using JSON.stringify(). I would have expected it to serialize to the model and contain the JSON values I passed in from the JS in the view. I can fix this by not using JSON.stringify() but then the values are always ignored e.g. always passed in as Name: null, Age: 0. I just can't seem to pass values like this.</p>

<p>I've tried changing the ajax call to POST but it changes nothing. I've tried setting the contentType to html and json, neither change anything.</p>

<p>Thanks in advance.</p>