Click or drag to resize
Json.NETDeserialize a Dictionary
 

This sample deserializes JSON into a dictionary.

Sample
Usage
 1string json = @"{
 2  'href': '/account/login.aspx',
 3  'target': '_blank'
 4}";
 5
 6Dictionary<string, string> htmlAttributes = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
 7
 8Console.WriteLine(htmlAttributes["href"]);
 9// /account/login.aspx
10
11Console.WriteLine(htmlAttributes["target"]);
12// _blank