[2,{"0":{"1":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]},"6":{"1.983":-1},"11":{"1.983":-1},"2":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]},"7":{"1.983":-1},"12":{"1.983":-1},"3":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]},"8":{"1.983":-1},"13":{"1.983":-1},"4":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]},"9":{"1.983":-1},"14":{"1.983":-1},"5":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]},"10":{"1.983":-1},"15":{"1.983":-1}},"2":0}]通过正则匹配取值 取值后结果如下
"1":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"6":{"1.983":-1},"11":{"1.983":-1}
"2":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"7":{"1.983":-1}
"12":{"1.983":-1}
"3":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"8":{"1.983":-1}
"13":{"1.983":-1}
"4":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"9":{"1.983":-1}
"14":{"1.983":-1}
"5":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"10":{"1.983":-1},"15":{"1.983":-1}
"1":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"6":{"1.983":-1},"11":{"1.983":-1}
"2":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"7":{"1.983":-1}
"12":{"1.983":-1}
"3":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"8":{"1.983":-1}
"13":{"1.983":-1}
"4":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"9":{"1.983":-1}
"14":{"1.983":-1}
"5":{"9.934":[0],"9.937":[1,4,5,7],"9.938":[2,3,8,9],"9.936":[6]}
"10":{"1.983":-1},"15":{"1.983":-1}
string input = "[2,{0:{1:{9.934:[0],9.937:[1,4,5,7],9.938:[2,3,8,9],9.936:[6]},6:{1.983:-1},11:{1.983:-1},2:{9.934:[0],9.937:[1,4,5,7],9.938:[2,3,8,9],9.936:[6]},7:{1.983:-1},12:{1.983:-1},3:{9.934:[0],9.937:[1,4,5,7],9.938:[2,3,8,9],9.936:[6]},8:{1.983:-1},13:{1.983:-1},4:{9.934:[0],9.937:[1,4,5,7],9.938:[2,3,8,9],9.936:[6]},9:{1.983:-1},14:{1.983:-1},5:{9.934:[0],9.937:[1,4,5,7],9.938:[2,3,8,9],9.936:[6]},10:{1.983:-1},15:{1.983:-1}},2:0}]";MatchCollection collection = Regex.Matches(input, @"\d+:{.+?}");
foreach (Match m in collection)
{
MessageBox.Show(m.Value.ToString());}就你给出的样本,可以这样处理"10":{"1.983":-1},"15":{"1.983":-1}应该是"10":{"1.983":-1}
"15":{"1.983":-1}吧
foreach (Match m in collection)
{
listBox1.Items.Add(m.Value.ToString() + "\r\n");}