title: deserialize json array list in c#
body: <p>I'm working on a project which has as backend mainly C#, but I'm not an experienced C# dev so I'm not able to figure out hot to fix a json deserialization of an list of objects. The following function is what takes care of the deserialization, but I get an error :</p>
  
  <pre><code>using System.IO;
  using System.Web;
  using Raven.Imports.Newtonsoft.Json;
  
  namespace Corina.Web.Handlers
  {
      public class JsonRequestHandler
      {
          public T Handle&lt;T&gt;(HttpContextBase context)
          {
              string requestData;
  
              context.Request.InputStream.Position = 0;
              using (var inputStream = new StreamReader(context.Request.InputStream))
              {
                  requestData = inputStream.ReadToEnd();
              }
  
              return JsonConvert.DeserializeObject&lt;T&gt;(requestData, new Raven.Imports.Newtonsoft.Json.Converters.StringEnumConverter());           
          }
      }
  }
  </code></pre>
  
  <p><code>Error</code> :</p>
  
  <blockquote>
    <p>Cannot deserialize the current JSON array (e.g. [1,2,3]) into type
    'Corina.Web.Views.DocumentViewModel' because the type requires a JSON
    object (e.g. {"name":"value"}) to deserialize correctly.</p>
    
    <p>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.</p>
  </blockquote>
  
  <p>Can anyone tell me how do I make the deserialization on a list of objects instead of an object ?</p>