Sunday, 15 February 2015

c# - Deserialize JSON object to Datatable -


IDE: Visual Studio 2010 Platform: C #

I am trying to replace the JSON object The data table is the code I have written in two different tables here:

  JavaScriptServiceLijer objJSSWW = new JavaScriptSerializer (); Var Last Batting Details WW = Jason Convert. Directoryal Object & lt; EmpDetails & gt; (JasonBettingWW); Public category EmpDetails {public list & lt; List & lt; Object & gt; & Gt; Table {receive; Set; } Public listing & lt; List & lt; Object & gt; & Gt; Table 1 {Get; Set; }}  

I want these two tables to be stored in the datatale. any suggestion?

Trying to give you some (at least the proxy) code, assume that you have your own There is a certain length of 'list' for this example, I'm assuming that there are 3 elements in your list.

  DataTable DataTable 1 = New DataLatest (); DataTable1.Columns.Add ("col1"); DataTable1.Columns.Add ("col2"); DataTable1.Columns.Add ("col3"); Foreign currency (var row in EmpDetails.Table) {dataTable1.Rows.Add (Line ToArray ()); } DataTable DataTable 2 = New Datatelle (); DataTable2.Columns.Add ("col1"); DataTable2.Columns.Add ("col2"); DataTable2.Columns.Add ("col3"); Forex Currency (var row in EmpDetails.Table1) {dataTable2.Rows.Add (Line ToArray ()); }  

If you have 2 tables with the same column then you can easily merge them:

  dataTable1.Merge (dataTable2);  

No comments:

Post a Comment