title: Deserialize JSON text to a specific object type using the Type name
body: <p>I used to deserialize JSON text to a strongly type object using the code below</p>
  
  <pre><code>Trainer myTrainer = JsonConvert.DeserializeObject&lt;Trainer&gt;(sJsonText);
  </code></pre>
  
  <p>Now I need to convert deserialize JSON text to a specific type knowing only the name of the type.</p>
  
  <p>I tried to use Reflection to get the Type from its name then use this type with JsonConvert as shown below:</p>
  
  <pre><code>Type myType = Type.GetType("Trainer");
  var jobj = JsonConvert.DeserializeObject&lt;myType &gt;(sJsonText);
  </code></pre>
  
  <p>but unfortunately, the error below shown up:</p>
  
  <pre><code>CS0118  'myType' is a variable but is used like a type
  </code></pre>
  
  <p>Is there a way that I can make reference to a class using a string?</p>