I've got a Dictionary<string,string>
that's attached to my model. When it reaches the client it's deserialized properly into [{"Text":"bla","Value":"V1"},{"Text":"abc","Value":"V2"}, {"Text":"def","Value":"V3"}]
.
It's being sent by the statement return View(model);
in my controller.
But when I send the same data down via JsonResult with the following:
var jsonResult = Json(myDictionary, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
It comes out like this:
{V1: "{ Value = V1, Text = bla }", V2: "{ Value = V2, Text = abc }", V3: "{ Value = V3, Text = def }"}
Is there a way to fix this in .NET or do I have to parse this and reconstruct it into something useful in javascript?