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. >
Post the complex object as a string and deserialize at the other end. There is no type-safety however for this. Here is a dictionary with string key and string array values.
js:
var data = { 'dictionary': JSON.stringify({'A': ['a', 'b'] }) };
$.ajax({
url: '/Controller/MyAction',
data: JSON.stringify(data),
type: 'POST',
contentType: 'application/json',
dataType: 'json'
});
c# controller:
[HttpPost]
public ActionResult MyAction(string dictionary)
{
var s = new System.Web.Script.Serialization.JavaScriptSerializer();
Dictionary d = s.Deserialize>(dictionary);
return View();
}