I'm trying the following : A model with a dictionary inside send it on the first ajax request then take the result serialize it again and send it back to the controller.
This should test that I can get back a dictionary in my model. It doesn't work
Here's my simple test:
public class HomeController : Controller
{
    public ActionResult Index (T a)
    {
      return View();
    }
    public JsonResult A(T t)
    {
      if (t.Name.IsEmpty())
      {
        t = new T();
        t.Name = "myname";
        t.D = new Dictionary<string, string>();
        t.D.Add("a", "a");
        t.D.Add("b", "b");
        t.D.Add("c", "c");
      }
      return Json(t);
    }
}
//model
public class T
{
  public string Name { get; set; }
  public IDictionary<string,string> D { get; set; }
}
The javascript:
$(function () {
    var o = {
        Name: 'somename',
        "D": {
            "a": "b",
            "b": "c",
            "c": "d"
        }
    };
    $.ajax({
        url: actionUrl('/home/a'),
        contentType: 'application/json',
        type: 'POST',
        success: function (result) {
            $.ajax({
                url: actionUrl('/home/a'),
                data: JSON.stringify(result),
                contentType: 'application/json',
                type: 'POST',
                success: function (result) {
                }
            });
        }
    });
});
In firebug the json received and the json sent are identical. I can only assume something gets lost on the way.
Anyone has an idea as to what I'm doing wrong?
 
     
     
     
    
 
     
     
     
     
     
     
    