如何使用C#将json数组转换为数据集

时间:2013-11-30 09:53:16

标签: c# jquery json

我有像这样的Json字符串,

var JSARR=
"[[{"BRANDID":"172","VARNAME":"sd",
"ETLVARID":"1","ETLVARNAME":"Ariel_Ariel_Print",
"ISFOR":0,"ISDEP":"1"},
{"BRANDID":"172","VARNAME":"h",
"ETLVARID":"1","ETLVARNAME":"Ariel_Ariel_TV",
"ISFOR":0,"ISDEP":"0"}],

[{"BRANDID":"238","VARNAME":"df",
"ETLVARID":"1","ETLVARNAME":"Ariel_Ariel_TV",
"ISFOR":0,"ISDEP":"1"},{"BRANDID":"238","VARNAME":"dfh",
"ETLVARID":"2","ETLVARNAME":"Ariel_Ariel Detergent_Print",
"ISFOR":0,"ISDEP":"0"}]]";

我需要将这个json String转换为两个数据表, 例如:

Datatable dt1="[{"BRANDID":"172","VARNAME":"sd",
"ETLVARID":"1","ETLVARNAME":"Ariel_Ariel_Print",
"ISFOR":0,"ISDEP":"1"},
{"BRANDID":"172","VARNAME":"h",
"ETLVARID":"1","ETLVARNAME":"Ariel_Ariel_TV",
"ISFOR":0,"ISDEP":"0"}]";

Datatable dt2="[{"BRANDID":"238","VARNAME":"df",
"ETLVARID":"1","ETLVARNAME":"Ariel_Ariel_TV",
"ISFOR":0,"ISDEP":"1"},{"BRANDID":"238","VARNAME":"dfh",
"ETLVARID":"2","ETLVARNAME":"Ariel_Ariel Detergent_Print",
"ISFOR":0,"ISDEP":"0"}]";

任何人都可以建议我。

0 个答案:

没有答案