I am trying to use jQuery.parseJSON to parse the return value from an MVC3 controller action.
Controller:
[HttpPost] public JsonResult LogOn(LogOnModel model, string returnUrl) { .. do stuff .. if (errors.Count() < 0) { return Json(new object[] { true, model, errors }); } return Json(new object[] { false, model, errors }); }
JQuery
$.ajax({ url: form.attr('action'), type: "POST", dataType: "json", data: form.serialize(), success: function (data) { var test = jQuery.parseJSON(data); } });
Json result from violinist:
Content-Type: application / json; encoding = UTF-8
[false, {"UserName": "1", "Password": "2", "RememberMe" false} [{"Key": "," Errors ": [{" Exception ": null" ErrorMessage ":" name The user or password is incorrect. "}]}]]
Fiddler can analyze the results:

A jQuery.parseJSON call returns null. My questions are: how can I parse the json return value into an object?
Thanks!
source share