title: Unable to deserialize JSON to a Dictionary<string, List<string>> using JavaScriptSerializer
body: <p>I have issues deserializing JSON in my c# code using the JavaScriptSerializer library.</p>
  
  <p>Here is my sample JSON: </p>
  
  <blockquote>
    <p>{"A":["a","b","c","d"],"B":["a"],"C":[]}</p>
  </blockquote>
  
  <p>I am using a Dictionary to hold the JSON as follows:</p>
  
  <pre><code>Dictionary&lt;string, List&lt;string&gt;&gt; myObject;
  </code></pre>
  
  <p>This is how I parse the JSON and cast it to my object:</p>
  
  <pre><code>myObject= (Dictionary&lt;string, List&lt;string&gt;&gt;)jsc.DeserializeObject(json);
  </code></pre>
  
  <p>However, at runtime, the previous line throws a Casting exception as follows</p>
  
  <blockquote>
    <p>Unable to cast object of type
    System.Collections.Generic.Dictionary2[System.String,System.Object]
    to type
    System.Collections.Generic.Dictionary2[System.String,System.Collections.Generic.List1[System.String]]</p>
  </blockquote>
  
  <p>For some reason the <code>JavaScriptSerializer</code> cannot recognize the JSON Array having strings as a <code>List&lt;string&gt;</code></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I populated my <code>Dictionary</code> data structure with some hardcoded strings to see what is the serialized version. It turns out to be exactly what my input JSON string is.</p>