2017-06-12 31 views
1

文字列とXmlデータをアプリケーションのJSON結果セットに変換する必要があるWebAPIを作成しました。しかし、私は以下 WebAPIからJSON形式のXmlと文字列データを取得

は私の方法

public string Index1(int? requestID) 
     { 
      System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); 
      List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>(); 
      Dictionary<string, object> row; 

      requestID = 453; 
      string strcon = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; 
      SqlConnection con = new SqlConnection(strcon); 
      con.Open(); 
      SqlCommand cmd = new SqlCommand("[dbo].[ERNST_usp_GetRequest]", con); 
      cmd.CommandType = System.Data.CommandType.StoredProcedure; 



      cmd.Parameters.Add("@RequestId", SqlDbType.Int).Value = requestID; 

      DataTable dt = new DataTable(); 
      //DataSet ds = new DataSet("Yo"); 
      SqlDataAdapter da = new SqlDataAdapter(); 
      da.SelectCommand = cmd; 

      //da.Fill(ds); 
      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<string, object>(); 
       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, dr[col]); 
       } 
       rows.Add(row); 
      } 
      con.Close(); 
      return serializer.Serialize(rows); 

}

私はこの結果

[{"RequestId":453,"RequestGuid":"a81b5878-6214-44b4-8888-aab46ce48adf","RequestXml":"{\"App\":\"B\",\"Authentication\":{\"UserID\":\"\",\"Password\":\"\"},\"TransactionDate\":\"1/27/2016\",\"TransactionCode\":\"150\",\"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)\/","ResponseXml":"{\"Request\":{\"TransactionID\":\"2847578_20100127.114729700\",\"Page\":\"AL005\",\"City\":null,\"County\":null,\"State\":\"AL\",\"TransactionCode\":\"100\",\"DeedNumberOfPages\":\"1\",\"MortgageNumberOfPages\":null,\"MortgageAmount\":null,\"OriginalDebtAmount\":null,\"UnpaidPrincipalBalance\":null,\"EstimatedValue\":\"150000\",\"Title\":null,\"TitleAmount\":null,\"OriginalTitleAmount\":null,\"OriginalMortgageDate\":null,\"AssignmentPages\":null,\"AssignmentNumber\":null,\"ReleasePages\":null,\"ReleaseNumber\":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\"}},\"Data\":{\"Refacts\":{\"STABBR\":\"AL\",\"ROFFICE\":\"Autauga County\",\"COUNTY\":\"Autauga\",\"PAGE\":\"AL005\",\"PAGEKEY2\":\"AL020\",\"PHONE\":\"334-361-3731\",\"EXT\":null,\"FAX\":\"334-361-3740\",\"TIMEZONE\":\"CST\",\"ATTN\":\"Attn: Real Estate Recording\",\"DEPT\":\"Autauga County Judge of Probate\",\"PAYEE\":\"Autauga County Judge of Probate\",\"FEEPAY\":\"Required from remitters with previous history of bad checks.\",\"MADDR1\":\"176 W. 5th St.\",\"MADDR2\":null,\"MCITYST\":\"Prattville, AL 36067-3041\",\"MCITY\":\"Prattville\",\"MZIP\":\"36067-3041\",\"CADDR1\":\"176 W. 5th St.\",\"CADDR2\":null,\"CCITYST\":\"Prattville, AL 36067\",\"CCITY\":\"Prattville\",\"CZIP\":\"36067\",\"HOURS\":\"8:30AM-4:30PM\",\"TITLE\":\"County Judge of Probate\",\"TAT\":\"3 days\",\"TATNUM\":\"3\",\"DEED\":\"Direct/Indirect\",\"MORTGAGE\":\"Direct/Indirect\",\"COUNTYFIPS\":\"01001\",\"LASTUPD\":\"05/31/09\",\"DEEDDESC\":\"Deed/Deed of Trust/Mortgage\",\"DEEDFEE\":\"11\",\"DEEDCD\":\"11\",\"MORTDESC\":null,\"MORTFEE\":\"0\",\"MORTCD\":\"0\",\"AMFEE\":\"11\",\"AMCD\":\"11\",\"ASSNDESC\":\"Assignment\",\"ASSNFEE\":\"11\",\"ASSNCD\":\"11\",\"SATDESC\":\"Release/Satisfaction\",\"SATFEE\":\"11\",\"SATCD\":\"11\",\"ADDPGFEE\":\"3\",\"ADDPGCD\":\"24\",\"NONSTDFEE\":\"0\",\"NSCD\":\"0\",\"SMPRNTFEE\":\"0\",\"SMPRCD\":\"0\",\"LEGALFEE\":\"11\",\"LEGALCD\":\"11\",\"ADDTYPE1\":\"3\",\"ADDFEE1\":\"1\",\"ADDCD1\":\"223\",\"ADDTYPE2\":\"59\",\"ADDFEE2\":\"2.5\",\"ADDCD2\":\"100\",\"ADDTYPE3\":\"19\",\"ADDFEE3\":\"88.88\",\"ADDCD3\":\"0\",\"ADDTYPE4\":\"0\",\"ADDFEE4\":\"0\",\"ADDCD4\":\"0\",\"ADDTYPE5\":\"0\",\"ADDFEE5\":\"0\",\"ADDCD5\":\"0\",\"ADDTYPE6\":\"0\",\"ADDFEE6\":\"0\",\"ADDCD6\":\"0\",\"DESC1\":\"Deed Tax\",\"TAX1\":\"0.5\",\"TAX1CD\":\"97\",\"DESC2\":\"Mortgage Tax\",\"TAX2\":\"0.15\",\"TAX2CD\":\"98\",\"DESC3\":null,\"TAX3\":\"0\",\"TAX3CD\":\"0\",\"TAXNOTE\":\"ALTAX\",\"SEARCH\":\"N\",\"COPYFEE\":\"1\",\"COPYCD1\":\"11\",\"COPYFEE2\":\"1\",\"COPYCD2\":\"24\",\"CERTFEE\":\"3\",\"CERTCD\":\"32\",\"DOCSYSTEM\":\"Book \u0026 Page\",\"DSEXAMPLE\":\"RLPY 900 Page 1000\",\"FEENOTE1\":\"AL005\",\"FEENOTE2\":\"ALEXT\",\"FEENOTE3\":null,\"RECNOTE1\":null,\"RECNOTE2\":null,\"RECNOTE3\":\"ALERR\",\"BLASSN\":\"Y\",\"BLREL\":\"Y\",\"ARNUM\":\"0\",\"ARTYPE\":null,\"DOCRETURN\":null,\"SASE\":\"R\",\"SUBDOCS\":\"N\",\"LDIND\":\"dm\",\"LDDESC\":\"Legal description required only with deeds and mortgages (trust deeds).\",\"CAPFEE\":\"0\",\"CAPCD\":\"0\",\"C1\":null,\"PIN\":\"y\",\"PINNAME\":\"PIN\",\"PINON\":\"a\",\"PINFORM\":null,\"PINNOTE\":null,\"WEBADDR\":\"None\",\"FIPSB\":\"01001\",\"UPDATED\":\"Notes\"}},\"Display\":{\"Calculation\":{\"Deed\":{\"Fee\":\"11\",\"Tax\":\"150\",\"RoundedDeed\":\"150000\",\"StateTax\":\"150.00\",\"CountyTax\":\"0.00\",\"CityTax\":\"0.00\",\"BuyerSplit\":\"0\",\"BuyerSplitRate\":\"0\",\"SellerSplit\":\"0\",\"SellerSplitRate\":\"0\",\"BuyerSellerNote\":null,\"RoundedDeedState\":\"0\",\"RoundedDeedCounty\":\"0\",\"RoundedDeedCity\":\"0\"},\"HUD\":{\"HUDLine\":[{\"LineNumber\":\"1109\",\"LineDescription\":\"Lenders Coverage\",\"TitlePremium\":\"0\"},{\"LineNumber\":\"1201\",\"LineDescription\":\"Recording fees\",\"DeedAmount\":\"11\",\"MortgageAmount\":\"0\",\"ReleaseAmount\":\"0\"},{\"LineNumber\":\"1202\",\"LineDescription\":\"City/County tax/stamps\",\"DeedAmount\":\"0.00\",\"MortgageAmount\":\"0\",\"ReleaseAmount\":\"0\"},{\"LineNumber\":\"1203\",\"LineDescription\":\"State tax/stamps\",\"DeedAmount\":\"150.00\",\"MortgageAmount\":\"0\",\"ReleaseAmount\":\"0\"},{\"LineNumber\":\"1204\",\"LineDescription\":\"Miscellaneous fee/taxes\",\"DeedAmount\":\"0\",\"MortgageAmount\":\"0\",\"ReleaseAmount\":\"0\"},{\"LineNumber\":\"1205\",\"LineDescription\":\"Miscellaneous fee/taxes\",\"DeedAmount\":\"0\",\"MortgageAmount\":\"0\",\"ReleaseAmount\":\"0\"}]},\"MortgageFee\":\"0\",\"MortgageTax\":\"0\",\"MortgageNote\":null,\"DeedFee\":\"11\",\"DeedTax\":\"150\",\"DeedNote\":null,\"Assumptions\":{\"Assumption\":[\"THERE ARE TWO OR FEWER GRANTORS AND TWO OR FEWER GRANTEES ON THE DOCUMENT.\",\"NOTE MARITAL STATUS OF INDIVIDUAL GRANTORS ON DEEDS AND MORTGAGES.\",\"THE LENDER IS CUSTOMARILY RESPONSIBLE FOR PAYMENT OF THE MORTGAGE TAX.\"]}},\"RecordingWorksheet\":{\"Office\":{\"County\":null,\"CourierAddress1\":\"176 W. 5th St.\",\"CourierAddress2\":null,\"CourierCityStateZIP\":\"Prattville, AL 36067\",\"Department\":\"Attn: Real Estate Recording\",\"Fax\":\"334-361-3740\",\"Jurisdiction\":\"Autauga County Judge of Probate\",\"MailingAddress1\":\"176 W. 5th St.\",\"MailingAddress2\":null,\"MailingCityStateZIP\":\"Prattville, AL 36067-3041\",\"MoneyOrder\":\"Required from remitters with previous history of bad checks.\",\"Payee\":\"Autauga County Judge of Probate\",\"Phone\":\"334-361-3731\",\"PhoneExt\":null,\"RecordingOffice\":\"Autauga County\",\"TimeZone\":\"CST\",\"Website\":\"None\"},\"BasicRecordingFees\":{\"Heading\":\"BASIC RECORDING FEES:\",\"Fee\":[{\"Description\":\"Deed/Deed of Trust/Mortgage\",\"Amount\":\"$11.00\",\"Label\":\"for the first page\"},{\"Description\":\"Amendment/Modification\",\"Amount\":\"$11.00\",\"Label\":\"for the first page\"},{\"Description\":\"Assignment\",\"Amount\":\"$11.00\",\"Label\":\"for the first page\"},{\"Description\":\"Release/Satisfaction\",\"Amount\":\"$11.00\",\"Label\":\"for the first page\"},{\"Description\":\"Power of Attorney\",\"Amount\":\"$11.00\",\"Label\":\"for the first page\"}]},\"AdditionalRecordingFees\":{\"Heading\":\"ADDITIONAL RECORDING FEES:\",\"Fee\":[{\"Description\":\"Additional pages and attachments\",\"Amount\":\"$3.00\",\"Label\":\"per additional page\"},{\"Description\":\"Indexing fee\",\"Amount\":\"$1.00\",\"Label\":\"per name over two for each party (note 1)\"},{\"Description\":\"Multiple assignments or releases\",\"Amount\":\"$2.50\",\"Label\":\"per reference after first\"},{\"Description\":\"Pages larger than 8 1/2\\\" by 14\\\"\",\"Amount\":\"Not Accepted\",\"Label\":null}]},\"RecordingFeeNotes\":{\"Heading\":\"RECORDING FEE NOTES:\",\"Note\":[\"1. Husband and wife with the same surname count as one name, but a wife who hyphenated her name counts as a separate name.\",\"2. If the mortgage is exempt from mortgage tax, add $3.00 to mortgage recording fee. The additional $3.00 recording fee is included in the calculated recording fee for a mortgage if the answer to the question regarding the Federal Credit Union is \\\"yes\\\".\"]},\"Taxes\":{\"Heading\":\"TRANSFER AND FINANCING FEES/TAXES:\",\"Tax\":[{\"Description\":\"Deed Tax\",\"Amount\":\"$0.50\",\"Label\":\"per $500 or fraction thereof of consideration\"},{\"Description\":\"Mortgage Tax\",\"Amount\":\"$0.15\",\"Label\":\"per $100 or fraction thereof financed\"}],\"Note\":\"Before recording a deed, obtain a slip showing value of property from Revenue Commissioner to use in tax computation.\"},\"Searches\":{\"Heading\":\"SEARCHES, COPIES AND CERTIFICATION:\",\"Note\":\"This office does not perform any searches of real estate records.\",\"Fee\":[{\"Description\":\"Copies made by office\",\"Amount\":\"$1.00\",\"Label\":\"per page\"},{\"Description\":\"Certification (in addition to copy fees)\",\"Amount\":\"$3.00\",\"Label\":\"per document\"}]},\"RecordingNotes\":{\"Heading\":\"DOCUMENTATION/RECORDING NOTES:\",\"Note\":[\"Blanket assignments are accepted.\",\"Blanket releases are accepted.\",\"Originals of real estate documents are always returned after recording.\",\"A self addressed stamped return envelope of the proper size is required.\",\"In subsequent related documents, only reference (book/page, doc#, etc.) to the original document is required.\",\"Index for Deeds: Direct/Indirect\",\"Index for Mortgages: Direct/Indirect\",\"Common document errors include fee incorrect, \\\"prepared by\\\" statement missing, notarial certificate incomplete or seal missing, grantee address missing from deed, reference to original document missing, and marital status of grantor missing from deed.\",\"This office reports a document turnaround time of 3 days\",\"Most recent annual document volume reported by this office: 12286\"],\"DocSystem\":\"Book \u0026 Page\",\"DSExample\":\"RLPY 900 Page 1000\"},\"LDDescription\":\"Legal description required only with deeds and mortgages (trust deeds).\",\"PIN\":{\"PINRequired\":\"PIN required on all real estate documents to be recorded.\"},\"OnlineSearching\":\"None\",\"ConformedCopies\":\"This office does not provide Conformed Copies.\",\"UCCOfficials\":{\"Heading\":\"RECORDING OFFICE STAFF:\",\"Official\":[{\"Description\":\"Head Official\",\"Name\":\"Alfred Q Booth\",\"Title\":\"Judge of Probate\"},{\"Description\":\"Other Official\",\"Name\":\"Kathy Evans\",\"Title\":\"Chief Clerk\"},{\"Description\":\"Other Official\",\"Name\":\"Cindy Holland\",\"Title\":\"Supervisor of Recording\"},{\"Description\":\"Other Official\",\"Name\":\"Shannon Smith\",\"Title\":\"Tag \u0026 Title Supervisor\"},{\"Description\":\"Other Official\",\"Name\":\"Mary Ann Keith\",\"Title\":\"Asst Chief Clerk\"}]}},\"DocumentLinks\":{\"Link\":[{\"Label\":\"Charts\",\"URL\":\"http://www.ernstpublishing.com/extsubscribers/ResourceDownload.asp?username=ctiuser\u0026password=dataplus\u0026action=authenticate\u0026doc=repdfs/intros/allcharts.pdf\"},{\"Label\":\"State Forms\",\"URL\":\"http://www.ernstpublishing.com/extsubscribers/ResourceDownload.asp?username=ctiuser\u0026password=dataplus\u0026action=authenticate\u0026doc=repdfs/illustrations/ALf.pdf\"}]}}}","ResponseDate":"\/Date(1264562248000)\/","DocumentTypeDetails":"{\"PageRec\":\"AL005\",\"State\":\"AL\",\"County\":\"Autauga County\",\"CityTown\":null,\"Zip\":null,\"ShowRecordingInfo\":\"true\",\"Deed\":{\"Checked\":\"True\",\"Pages\":\"1\",\"ConsiderationAmount\":\"150000\"},\"MortgageDeed\":{\"Checked\":\"False\",\"Pages\":null,\"NewDebtAmount\":null},\"MortgageRefi\":{\"Checked\":\"False\",\"Pages\":null,\"NewDebtAmount\":null,\"OriginalDebt\":null,\"UnpaidDebt\":null},\"Assignment\":{\"Checked\":\"False\",\"Pages\":null,\"Assignments\":null},\"ReleaseSatisfaction\":{\"Checked\":\"False\",\"Pages\":null,\"ReleasesSatisfactions\":null},\"Questions\":{\"Question\":{\"Number\":\"Q4\",\"Category\":\"Deed\",\"Type\":\"bool\",\"QuestionText\":\"Are the deed and mortgage being recorded at the same time?\",\"Answer\":\"1\"}}}","ShowRecordingInfo":true,"IsOfficeDetailsRequest":false,"UserId":8515,"IsSaved":true,"Name":"saving test check no link to ODP"}] 

を取得していますで何をしたい正確なフォーマットどのような結果セット、私は取得していますではありませんしかし、私が望むフォーマット結果は、 "/"

[ 
    { 
     "RequestId": 453, 
     "RequestGuid": "a81b5878-6214-44b4-8888-aab46ce48adf", 
     "ShowRecordingInfo": true, 
     "IsOfficeDetailsRequest": false, 
     "UserId": 8515, 
     "IsSaved": true, 
     "Name": "saving test check no link to ODP", 
     "DocumentTypeDetails": { 
      "PageRec": "AL005", 
      "State": "AL", 
      "County": "Autauga County", 
      "CityTown": null, 
      "Zip": null, 
      "ShowRecordingInfo": "true", 
      "Deed": { 
       "Checked": "True", 
       "Pages": "1", 
       "ConsiderationAmount": "150000" 
      }, 
      "Amend": { 
       "Checked": "False", 
       "Pages": "1", 
       "ConsiderationAmount": "150000" 
      }, 
      "MortgageDeed": { 
       "Checked": "False", 
       "Pages": null, 
       "NewDebtAmount": null 
      }, 
      "MortgageMod": { 
       "Checked": "False", 
       "Pages": null, 
       "NewDebtAmount": null 
      }, 
      "MortgageRefi": { 
       "Checked": "False", 
       "Pages": null, 
       "NewDebtAmount": null, 
       "OriginalDebt": null, 
       "UnpaidDebt": null 
      }, 
      "Assignment": { 
       "Checked": "False", 
       "Pages": null, 
       "Assignments": null 
      }, 
      "ReleaseSatisfaction": { 
       "Checked": "False", 
       "Pages": null, 
       "ReleasesSatisfactions": null 
      }, 
      "poa":{ 
       "Checked":"False", 
       "Pages":null 
      }, 
      "Questions": { 
       "Question": { 
        "Number": "Q4", 
        "Category": "Deed", 
        "Type": "bool", 
        "QuestionText": "Are the deed and mortgage being recorded at the same time?", 
        "Answer": "1" 
       } 
      } 
     }, 
     "RequestXml": { 
      "App": "B", 
      "Authentication": { 
       "UserID": "", 
       "Password": "" 
      }, 
      "TransactionDate": "1/27/2016", 
      "TransactionCode": "150", 
      "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" 
     }, 

     } 
    } 
] 

は、どのように私は、Web APIを使用している場合は、そのSystem.Web.Script.Serialization.JavaScriptSerializerライブラリを必要としない、望ましい結果

+0

興味深い。 XMLを投稿できますか?あなたはNewtonsoftにもタグを付けることでいくつかの反応を得ることができます。これが本当に変換を行っています。 –

+0

@WilliamWalseth全体的に特定のXmlデータはありません...私はいくつかの列がxmlにあり、いくつかの文字列が....であるdbからデータを取得しています。stringとxml JSONで別々に変換できますが、私はすべてのものを1つの単一のものにしたいです... –

答えて

0

を得ることができます。 Web APIメソッドの戻り値の型をModelクラスに変更し、モデルを返すだけです。 Web APIが自動的にあなたのためにそれをシリアル化します。

+0

私はモデルクラスを持っていません..何かXmlはデータベースから取得します。私は単にそれを送信する必要があります..任意のモデルオブジェクト –

関連する問題