title: How to pass JSON parameter with $ajax to asmx web service
body: <p>My paramerter as below:</p>
  
  <pre><code>var pMaster = '{"tid" : "474", "fid":"2"}';
  var pDetail = '[{"recid":5618,"tid":"474","itemid":"1435","nar1":""},{"recid":5619,"tid":"474","itemid":"1203","nar1":""},{"recid":5620,"tid":"474","itemid":"1205","nar1":""}]';
  var e = '{PurcMast: ' + pMaster  + ', PurDetail: ' + pDetail + '}';
  </code></pre>
  
  <p>I am calling ajax as below </p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: "WebService.asmx/saveValue",
          data: e,
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (result) {
              alert(result.d);
          },
          error: function (jqXHR) { alert(jqXHR.responseText); }
      });
  </code></pre>
  
  <p>And WebService.asmx code as below:</p>
  
  <pre><code>[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  [WebMethod]    
  public void saveValue(string PurcMast, string PurDetail)
  {
      System.Data.DataTable purMaster = Common.CommonFunction.convertJSON2Table(Purchase);
      System.Data.DataTable purDetail = Common.CommonFunction.convertJSON2Table(PurchaseDetail);
  }
  </code></pre>
  
  <p>I am getting error as below:</p>
  
  <blockquote>
    <p>Uncaught Error.{"Message":"No parameterless constructor defined for type of \u0027System.String\u0027.","StackTrace":"   at System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary<code>2 dictionary, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)\r\n   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)\r\n   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object\u0026 convertedObject)\r\n   at System.Web.Script.Services.WebServiceMethodData.StrongTypeParameters(IDictionary</code>2 rawParams)\r\n   at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary<code>2 parameters)\r\n   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary</code>2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.MissingMethodException"}</p>
  </blockquote>
  
  <p>Guys please help me, i don't understand what wrong i am doing.</p>