我有一个JSON格式的长字符串。这就是它的样子:
{"ShowMapUrl":true,"GameDiffusionType":5,"InputYellowCards":false,"DisplayYellowCards":false,"InputYellowCards2":false}
请注意,字符串要长得多。我一直试图通过使用json.NET将该字符串转换为字典而没有成功。有什么提示吗?
答案 0 :(得分:1)
使用JsonConvert.DeserializeObject<Dictionary<string, object>>()
:
var json = @"{""ShowMapUrl"":true,""GameDiffusionType"":5,""InputYellowCards"":false,""DisplayYellowCards"":false,""InputYellowCards2"":false}";
var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);