JQuery, ASMX and Formatting JSON
I have the following JS

      $('#Submit').click(function () {
                var name = $('#Name').val();
                var age = $('#Age').val();
                var phonenumber = $('#PhoneNumber').val();
                var isMale = $('#IsMale').val();
                var formdata = "'formdata':{name:'" + name + "',age:'" + age + "',phonenumber:'" + phonenumber + "',ismale:'" + isMale + "'}";
                $.ajax({
                    type: "Post",
                    url: "WebService/FormSubmission.asmx/SavePafForm",
                    data: formdata,
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    processdata: true,
                    success: function (msg) { alert(msg.d); },
                    error: function (result, errortype, exceptionobject) { alert('Error:' + result.responseText); }

                })

I have the following asmx method

     [WebMethod]
        public string SavePafForm(string formdata)
        {
            string test = formdata;

            return test;
        }

I get the following error

    Error:{"Message":"Invalid JSON primitive: \u0027{name:\u0027tim\u0027,age:\u0027\u0027,phonenumber:\u0027\u0027,ismale:\u0027on\u0027}\u0027.","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

When I change my json string to this

    var formdata = "{name:'" + name + "',age:'" + age + "',phonenumber:'" + phonenumber + "',ismale:'" + isMale + "'}";

and my web method to have this signature

    public string SavePafForm(string name, string age, string phonenumber, string ismale)

I don't get any error.  

It's my goal to pass in up to 20 parameters to this method...I'd like to pass it in as one object I can deal with, rather than 20 parameters in the method signature.

Any ideas?


JQuery, ASMX and Formatting JSON
===

I have the following JS

      $('#Submit').click(function () {
                var name = $('#Name').val();
                var age = $('#Age').val();
                var phonenumber = $('#PhoneNumber').val();
                var isMale = $('#IsMale').val();
                var formdata = "'formdata':{name:'" + name + "',age:'" + age + "',phonenumber:'" + phonenumber + "',ismale:'" + isMale + "'}";
                $.ajax({
                    type: "Post",
                    url: "WebService/FormSubmission.asmx/SavePafForm",
                    data: formdata,
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    processdata: true,
                    success: function (msg) { alert(msg.d); },
                    error: function (result, errortype, exceptionobject) { alert('Error:' + result.responseText); }

                })

I have the following asmx method

     [WebMethod]
        public string SavePafForm(string formdata)
        {
            string test = formdata;

            return test;
        }

I get the following error

    Error:{"Message":"Invalid JSON primitive: \u0027{name:\u0027tim\u0027,age:\u0027\u0027,phonenumber:\u0027\u0027,ismale:\u0027on\u0027}\u0027.","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

When I change my json string to this

    var formdata = "{name:'" + name + "',age:'" + age + "',phonenumber:'" + phonenumber + "',ismale:'" + isMale + "'}";

and my web method to have this signature

    public string SavePafForm(string name, string age, string phonenumber, string ismale)

I don't get any error.  

It's my goal to pass in up to 20 parameters to this method...I'd like to pass it in as one object I can deal with, rather than 20 parameters in the method signature.

Any ideas?

