title: Can you deserialize a JSON string to a C# array?
body: <p>I'm trying to deserialize the JSON string </p>
  
  <pre><code>[{ "key" : "1", "value" : "open"}, {"key" : "2", "value" : "closed"}, {"key" : "3", "value" : "pending"}]
  </code></pre>
  
  <p>into a C# array. I'm getting the error "No parameterless constructor defined for type of 'System.Array'." I'm pulling the JSON from a database, then I wanted to deserialize it so I could access the values and update another field in my database with whatever a user passed in. This is just an example that I'm trying though and I need it to be dynamic, not static, since the JSON string contained in the database can be variable.</p>
  
  <p>I tried using a dictionary earlier, but had no luck with that. So I'm trying a different approach now by deserializing it to an array then I was going to populate the dictionary from the array.</p>
  
  <p>This is the method I'm trying to implement with at the moment...although I've tried several others...</p>
  
  <pre><code> IList&lt;Array&gt; ValueArray = new JavaScriptSerializer().Deserialize&lt;IList&lt;Array&gt;&gt;(this.Parameter.ValueList); 
   //this.Parameter.ValueList just contains my JSON string
  </code></pre>
  
  <p>I'm thinking that I can't do this without creating my own class?</p>
  
  <p>When I tried using a dictionary, I tried this</p>
  
  <pre><code>Dictionary&lt;string, string&gt; ValueList =
                  JsonConvert.DeserializeObject&lt;Dictionary&lt;string, string&gt;&gt;(this.Parameter.ValueList);  
  </code></pre>
  
  <p>but received this error</p>
  
  <blockquote>
    <p>"Cannot deserialize the current JSON array (e.g. [1,2,3]) into type
    'System.Collections.Generic.Dictionary`2[System.String,System.String]'
    because the type requires a JSON object (e.g. {"name":"value"}) to
    deserialize correctly. To fix this error either change the JSON to a
    JSON object (e.g. {"name":"value"}) or change the deserialized type to
    an array or a type that implements a collection interface (e.g.
    ICollection, IList) like List that can be deserialized from a JSON
    array. JsonArrayAttribute can also be added to the type to force it to
    deserialize from a JSON array. Path '', line 1, position 1."</p>
  </blockquote>
  
  <p>So I started to try using an array instead.</p>