I am trying to use JSON with jquery and .Net. I am using json2.js for JavaScript and Newtonsoft.JSON for .Net serialization. Here goes my code:
JavaScript ------------------------------------------------------------------- $.ajax({ url: "http://localhost/JSONSample/default.aspx", method: "GET", datatype: "json", contentType: "application/json; charset=utf-8", data: {name: 'User'}, success: function(result) { var oResult = JSON.parse(result); alert(oResult.Guid); }, error: function() { alert("Some error occured"); } }); Server side code -------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { if(Request.Params["name"] != null && Request.Params["name"].ToString () != "") { GetName(); } } public void GetName() { System.Web.Script.Serialization ser = new System.Web.Script.Serialization(); System.Text.StringBuilder oBuilder = new System.Text.StringBuilder(); oBuilder.Append("{"); oBuilder.AppendFormat("'{0}' : '{1}'", "Guid", Guid.NewGuid()); oBuilder.Append("}"); string json = ser.Serialize(oBuilder.ToString()); Response.Write(json); Response.Flush(); Response.Close(); } I am able to get the result in success function. But the oResult.Guid is undefined. When I am trying to alert oResult, it gives me: { 'Guid' : '16ba666a-cd2a-41b6-b0b1-5f072d44d488' } Can anyone help me why is the oResult.Guid undefined..?