title: NewtonSoft DeserializeObject<List<typename>> . What types server sends I donot know
body: <p>I have similar question.</p>
  
  <p><a href="https://stackoverflow.com/questions/11220776/deserialize-list-of-objects-using-json-net">deserialize list of objects using json.net</a></p>
  
  <p>Normally we do like below to deserialize a list of objects. But in my case I cannot hard code <code>List&lt;Category&gt;</code> since I do not know what will be the type. </p>
  
  <pre><code>JsonConvert.DeserializeObject&lt;List&lt;Category&gt;&gt;(response.dtosString)
  </code></pre>
  
  <p>There will a property in json which will give me type name using that I can create a Type like below</p>
  
  <pre><code>string typename = string.Format("{0}, ABC.EDF", myresponse.dtoType);
  Type resultType = Type.GetType(typename);
  </code></pre>
  
  <p>Now I want to use something like below</p>
  
  <pre><code>JsonConvert.DeserializeObject&lt;List&lt;typename&gt;&gt;(myresponse.dtosString)
  </code></pre>
  
  <p>I tried below but not works since it says dynamic cannot be converted and need explicit conversion logic.</p>
  
  <p><a href="https://stackoverflow.com/questions/21246609/deserializing-an-unknown-type-in-json-net">Deserializing an unknown type in JSON.NET</a></p>
  
  <p><strong>SOLUTION:</strong> Thanks to Chris for pointing me in right direction.</p>
  
  <p>This is what I did</p>
  
  <pre><code>string typename = string.Format("{0}, ABC.EDF", myresponse.dtoType);
  Type resultType = Type.GetType(typename);
  var listType = typeof(List&lt;&gt;);
  Type constructedListType = listType.MakeGenericType(resultType);
  var myData = Newtonsoft.Json.JsonConvert.DeserializeObject(myresponse.dtosString, constructedListType); 
  </code></pre>
  
  <p>After this I just provide myData to a read function which is in third party library which I donot have access to and that process the data.</p>