Deserialize a Dictionary |
This sample deserializes JSON into a dictionary.
string json = @"{ 'href': '/account/login.aspx', 'target': '_blank' }"; Dictionary<string, string> htmlAttributes = JsonConvert.DeserializeObject<Dictionary<string, string>>(json); Console.WriteLine(htmlAttributes["href"]); // /account/login.aspx Console.WriteLine(htmlAttributes["target"]); // _blank