Feb 01, 2011, 4:03 AM
[CLOSED] Cannot deserialize JSON object into type 'System.Collections.Generic.Dictionary`2[System.String,System.String][]
Hi...
i have kept this code in Page_Load,when try to run this im getting Error:"Cannot deserialize JSON object into type 'System.Collections.Generic.Dictionary`2[System.String,System.String][]"
i have kept this code in Page_Load,when try to run this im getting Error:"Cannot deserialize JSON object into type 'System.Collections.Generic.Dictionary`2[System.String,System.String][]"
string r ="{ID:1,Name:Hi Rest}";
Dictionary<string, string>[] companies = JSON.Deserialize<Dictionary<string, string>[]>(r);
StringBuilder sb = new StringBuilder();
foreach (Dictionary<string, string> row in companies)
{
foreach (KeyValuePair<string, string> keyValuePair in row)
{
sb.Append(keyValuePair.Key);
if (keyValuePair.Key.ToString() == "ID")
{
txtID.Text = Convert.ToString(keyValuePair.Value);
}
else if (keyValuePair.Key.ToString() == "Name")
{
txtName.Text = Convert.ToString(keyValuePair.Value);
}
}
}
Please solve my problem
Last edited by Daniil; Feb 02, 2011 at 10:43 AM.
Reason: [CLOSED]