我的 C# 程序中有以下代码,我需要将 json 结构转换为字典。
string json = @"[{""id"":""51851"",""name"":""test {""id"":""527"",""name"":""test1""}]";
var json_serializer = new JavaScriptSerializer();
Dictionary<string, object> dictionary = json_serializer.Deserialize<Dictionary<string, object>>(json);
在运行此程序时,我收到以下错误。
Type 'System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is not supported for deserialization of an array.
谁能帮我弄清楚这有什么问题?