如何逐个将整个DataRow转换为键值对

时间:2018-01-16 09:05:43

标签: c# wcf

我正在寻找c#中的解决方案,我需要将所有DataRow转换为Key值对。 以下是我现在的数据,

{
"DynamicColumnsList": 
[   
{
"myRow":"Title|KeyQuestion|OfferingBanner|OfferingOverview|Image_x0020_Icon|KeyContacts|KeyContacts_x003a_ID|KeyInvestmentAreas|KeyIssuesMarketDrivers|KeyServices|TypicalBuyers|AdditionalColumn1|Base64Image|Base64Banner|FSOCrossSector|ID"     

},
{
"myRow":"BigBetsTestTier1|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|SomeData|14"
 }
 {
"myRow": "....."
 }
 {
 "myRow": "....."
 }
 {
 "myRow": "....." and so on...
 }
 ]
}

第一个myRow有列名,下面是第二个myRow有相应的值,依此类推,直到10行。

有没有可能的方法来获得如下格式的数据,

{
"DynamicColumnsList": 
[ 
{
 "Title": "BigBetsTestTier1",
 "KeyQuestion": "SomeData",
 "OfferingBanner": "SomeData",
 "OfferingOverview": "SomeData",
 "Image_x0020_Icon": "SomeData",
 "KeyContacts": "SomeData",
 "KeyContacts_x003a_ID":"SomeData",
 "KeyInvestmentAreas":"SomeData",
 "KeyIssuesMarketDrivers":"SomeData",
 "KeyServices":"SomeData",
 "TypicalBuyers":"SomeData",
 "AdditionalColumn1":"SomeData",
 "Base64Image":"SomeData",
 "Base64Banner":"SomeData",
 "FSOCrossSector":"SomeData",
 "ID":"14"
 },
 {
 ...
 },
 {
  ... and so on 
 }
]
}

0 个答案:

没有答案