title: Parse JSON object in c# passed through jquery Ajax
body: <p>I know this is one of the most commonly asked questions in ASP.net but my scenario is a bit different. </p>
  
  <p>I have a json object which I am converting to a string and passing it to web method via jquery ajax.</p>
  
  <pre><code>function Save() {
              var content = $('#radGridSMT_ctl00 tr').not('#radGridSMT_ctl00 thead tr');
              var header = $('#radGridSMT_ctl00_Header thead tr');
              var result = [];
              for (var i = 0; i &lt; content.length - 1; i++) {
                  item = {}
                  var headerName;
                  item[header[0].children[0].textContent] = content[i].children[0].textContent;
                  item[header[0].children[1].textContent] = content[i].children[1].textContent;
                  item[header[0].children[2].textContent] = content[i].children[2].textContent;
                  item[header[0].children[3].textContent] = content[i].children[3].textContent;
                  item[header[0].children[4].textContent] = content[i].children[4].textContent;
                  item[header[0].children[5].textContent] = content[i].children[5].textContent;
                  item[header[0].children[6].textContent] = content[i].children[6].textContent;
                  item[header[0].children[7].textContent] = content[i].children[7].textContent;
                  item[header[0].children[8].textContent] = content[i].children[8].textContent;
                  item[header[0].children[9].textContent] = content[i].children[9].textContent;
                  item[header[0].children[10].textContent] = content[i].children[10].textContent;
                  item[header[0].children[11].textContent] = content[i].children[11].textContent;
                  item[header[0].children[12].textContent] = content[i].children[12].textContent;
                  result.push(item);
              }
              result = JSON.stringify({ data: result });
              $.ajax({
                  type: "POST",
                  url: "SMTRequiredHour.aspx/SaveData",
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  data: result,
                  success: function (response) {
  
                  },
                  failure: function (response) {
  
                  }
              });
          }
  </code></pre>
  
  <p>Now when I receive it in web method is comes in the form of an object.</p>
  
  <pre><code>    [WebMethod]
      public static void SaveData(object data)
      {
          CreateDatatable(data);
          var d = initialData;
          var obj = JsonConvert.DeserializeObject(data);
      }
  </code></pre>
  
  <p>The JsonConvert.DeserializeObject takes a string not an object and that's the problem. I am unable to convert JSON object to string.</p>
  
  <p>I can't create strong type object because the columns in the json object are generate dynamically and may not be same every time.</p>
  
  <p>How to parse JSON object to a string so that I can deserialize it.</p>