title: Json deserialization Mvc 4 Knockout js
body: <p>I'm having problems when I try to deserialize json into a object in MVC4.</p>
  
  <p>I have a Viewmodel:</p>
  
  <pre><code> public class TestViewModel
  {
      public string Code { get; set; }
  
  }
  </code></pre>
  
  <p>On the view I get the model and serialize the object using Json.net</p>
  
  <pre><code>var Vm = function(data) {
          var self = this;
  
          ko.mapping.fromJS(data, {}, self);
  
          self.GetResults = function() {
              $.ajax({
                  type: "POST",
                  url: '@Url.Action("Action", "Controller")',
                  data: ko.mapping.toJSON(self),
                  success: function(data) {
                      alert('OK');
                  }
              });
          };
      };
  
      var viewModel = new Vm(@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model)));
      ko.applyBindings(viewModel);
  </code></pre>
  
  <p>My problem is when I call GetResults the action in the controller, all properties are null.</p>
  
  <p>My Json is:</p>
  
  <pre><code>{"Code":"TestCode"}
  </code></pre>
  
  <p>I have the same structure in a MVC3 project and works fine. I'm missing something in MVC4?</p>
  
  <p>Cheers!</p>