c# deserialize to dictionary code example
Example 1: c# initialize dictionary
Dictionary<int, string> dictNew = new Dictionary<int,string>()
{
{1, "true"},
{2, "false"}
}
Example 2: deserialize object to dictionary c#
string json = @"{""key1"":""value1"",""key2"":""value2""}";
var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);