[CLOSED] Cannot deserialize JSON object into type 'System.Collections.Generic.Dictionary`2[System.String,System.String][]

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [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][]"





    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]

Similar Threads

  1. Replies: 8
    Last Post: Jul 20, 2012, 1:33 PM
  2. [CLOSED] Unsupported type: System.Guid (Migration from 0.8.3 to 1.0)
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 07, 2011, 8:16 AM
  3. Replies: 0
    Last Post: Dec 27, 2009, 1:47 PM
  4. Replies: 2
    Last Post: Aug 31, 2009, 6:03 PM
  5. Replies: 3
    Last Post: Nov 12, 2008, 5:16 AM

Posting Permissions