我有一个JSON格式的长字符串。这是它的样子:
{"ShowMapUrl":true,"GameDiffusionType":5,"InputYellowCards":false,"DisplayYellowCards":false,"InputYellowCards2":false}
请注意,字符串要长得多。我一直在尝试通过使用 json.NET 将该字符串转换为字典,但没有成功。有什么提示吗?
使用 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);