0
我有這樣檢索字典在C#.NET
{
"A" : {
"A1" : {
"er" : false,
"hy" : false,
"fv" : false,
"fr" : false
},
"A2" : {
"fr" : false,
"ty" : false,
"ty" : false,
},
"B" : {
"B1" : {
"er" : false,
"hy" : false,
"fv" : false,
"fr" : false
},
"B2" : {
"fr" : false,
"ty" : false,
"ty" : false,
},
}
}
一本字典我試圖找回A1和A2字典的值作爲一個單獨的字典
我已經試過
Dictionary<string, Dictionary<string, object>> dict =
jss.Deserialize<Dictionary<string, Dictionary<string, object>>>json.ToString());
Dictionary<string, object> dict1 = dict["A"];
Dictionary<string, object> dict2 = dict1["A1"];//error here
不能將類型'object'隱式轉換爲'System.Collections.Generic.Dictionary'。存在明確的轉換(您是否缺少演員?)
如何解決此問題?
而是張貼的僞代碼它會一直看到真正的字典的初始化更有幫助的。 –
'ToString'關閉後多餘的括號是什麼? –