double quotes in returned json

knoveplus

New Member
I have an action returning a simple json. For demonstration purposes I will paste sample code. Simple class to serialize:\[code\]public class Employee{ public string FullName { get; set; }}\[/code\]The action which returns the json:\[code\]public JsonResult Test(){ var employee = new Employee { FullName = "Homer Simpson" }; var serializer = new JavaScriptSerializer(); var json = serializer.Serialize(employee); return Json(json, JsonRequestBehavior.AllowGet);}\[/code\]Here is where I am confused. When I call this action from the browser and look at the response with Fiddler, this is the result:\[code\]HTTP/1.1 200 OKServer: ASP.NET Development Server/10.0.0.0Date: Mon, 15 Aug 2011 20:52:34 GMTX-AspNet-Version: 4.0.30319X-AspNetMvc-Version: 3.0Cache-Control: privateContent-Type: application/json; charset=utf-8Content-Length: 34Connection: Close"{\"FullName\":\"Homer Simpson\"}"\[/code\]The "JSON" tab in Fiddler reads "The selected response does not contain valid JSON text". The valid response should be like this:\[code\]"{"FullName":"Homer Simpson"}"\[/code\]What is going on here?Thanks
 
Top