title: How to send Xml data and string in JSON form using Web API
body: <p>I am fetching a row from database which is having XML columns as well as string columns. I am able to convert XML data in JSON and then insert it along with other  string data into DataTable and then convert then both to JSON string.<br>
  But then the JSON data which i initially got from converting XML that itself is again getting converted which is giving me Wrong data.<br></p>
  
  <pre><code>public string FetchData(int? requestID)
  {
      System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
      List&lt;Dictionary&lt;string, object&gt;&gt; rows = new List&lt;Dictionary&lt;string, object&gt;&gt;();
      Dictionary&lt;string, object&gt; row;
  
      requestID = 453;
      string strcon = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
      SqlConnection con = new SqlConnection(strcon);
      con.Open();
      SqlCommand cmd = new SqlCommand("[dbo].[usp_GetData]", con);
      cmd.CommandType = System.Data.CommandType.StoredProcedure;
  
  
  
      cmd.Parameters.Add("@RequestId", SqlDbType.Int).Value = requestID;
  
      DataTable dt = new DataTable();
  
      SqlDataAdapter da = new SqlDataAdapter();
      da.SelectCommand = cmd;
  
  
      da.Fill(dt);
  
      //string s = ds.Tables[0].Rows[0][4].ToString();
      string id = dt.Rows[0]["RequestId"].ToString();
      string guid = dt.Rows[0]["RequestGuid"].ToString();
      string requestXml = dt.Rows[0]["RequestXml"].ToString();
      string requestDate = dt.Rows[0]["RequestDate"].ToString();
      string responseXml = dt.Rows[0]["ResponseXml"].ToString();
      string responseDate = dt.Rows[0]["ResponseDate"].ToString();
      string documentDetails = dt.Rows[0]["DocumentTypeDetails"].ToString();
      string showRecInfo = dt.Rows[0]["ShowRecordingInfo"].ToString();
      string isOfficeDetailsRequest = dt.Rows[0]["IsOfficeDetailsRequest"].ToString();
      string UserId = dt.Rows[0]["UserId"].ToString();
      string isSaved = dt.Rows[0]["IsSaved"].ToString();
      string name = dt.Rows[0]["Name"].ToString();
  
      XmlDocument xmlreq = new XmlDocument();
      XmlDocument xmlres = new XmlDocument();
      XmlDocument xmldoc = new XmlDocument();
      // xml.LoadXml(s);
      xmlreq.LoadXml(requestXml);
      xmlres.LoadXml(responseXml);
      xmldoc.LoadXml(documentDetails);
  
  
      string reqjson = JsonConvert.SerializeXmlNode(xmlreq, Newtonsoft.Json.Formatting.None, true);
      string resjson= JsonConvert.SerializeXmlNode(xmlres, Newtonsoft.Json.Formatting.None, true);
      string docjson= JsonConvert.SerializeXmlNode(xmldoc, Newtonsoft.Json.Formatting.None, true);
  
      foreach(DataRow dr in dt.Rows)
      {
          row = new Dictionary&lt;string, object&gt;();
          foreach(DataColumn col in dt.Columns)
          {
              if(col.ColumnName== "RequestXml")
              {
                  row.Add(col.ColumnName, reqjson);
              }
              else if (col.ColumnName == "ResponseXml")
              {
                  row.Add(col.ColumnName, resjson);
              }
              else if (col.ColumnName == "DocumentTypeDetails")
              {
                  row.Add(col.ColumnName, docjson);
              }
              else
                  row.Add(col.ColumnName, serializer.Serialize(dr[col]));
          }
          rows.Add(row);
      }
      con.Close();
      return serializer.Serialize(rows);  
  }
  </code></pre>
  
  <p>The Xml data i am getting is coming in this Format.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>"RequestId": 453,
          "RequestGuid": "a81b5878-6214-44b4-8888-aab46ce48adf",
          "RequestXml": "{\"App\":\"B\",\"Authentication\":{\"UserID\":\"tb\",\"Password\":\"abc\"},\"TransactionDate\":\"1/27/2001\",\"TransactionCode\":\"6100\",\"Property\":{\"Page\":\"AL005\",\"City\":null,\"County\":null,\"State\":\"AL\",\"EstimatedValue\":\"150000\",\"MortgageAmount\":null,\"OriginalDebtAmount\":null,\"UnpaidPrincipalBalance\":null,\"OriginalMortgageDate\":null,\"StateQuestions\":{\"Q1\":\"0\",\"Q2\":\"0\",\"Q3\":\"0\",\"Q4\":\"1\",\"Q5\":\"0\",\"Q6\":\"0\",\"Q7\":\"0\",\"Q8\":\"0\",\"Q9\":\"0\",\"Q10\":\"0\",\"Q11\":\"0\",\"Q12\":\"0\",\"Q13\":\"0\",\"Q14\":\"0\",\"Q15\":\"0\",\"Q16\":\"0\",\"Q17\":\"0\",\"Q18\":\"0\",\"Q19\":\"0\",\"Q20\":\"0\",\"Q21\":\"0\",\"V1\":\"0\",\"V2\":\"0\",\"V3\":\"0\",\"V4\":\"0\"}},\"NumberOfPages\":{\"Mortgage\":null,\"Deed\":\"1\"},\"Assignment\":{\"Pages\":null,\"NumberOfAssignments\":null},\"Release\":{\"Pages\":null,\"NumberOfReleases\":null},\"DataSource\":\"P\"}",
          "RequestDate": "\/Date(1264562248000)\/",</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do i convert everything into one JSON string so that i can use it in my application</p>
  
  <p>Desired Output</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>"SomeString":{
    "A":"A",
    "B":"B"
  }</code></pre>
  </div>
  </div>
  </p>