title: How to Deserialize a very Simple RestSharp JSON Object?
body: <p>Forgive what surely has to be a dumb question, but I'm just starting out with C# using JSON.</p>
  
  <p>I have this class:</p>
  
  <pre><code>public class DBCount
  {
      public string Count { get; set; }
  }
  </code></pre>
  
  <p>I create an instance:</p>
  
  <p><code>public DBCount dbCount;</code></p>
  
  <p>My web service is returning this:</p>
  
  <blockquote>
    <p>[{"Count":"234"}]</p>
  </blockquote>
  
  <p>This code throws an invalid cast when it tries to deserialize the response:</p>
  
  <pre><code>var client = new RestClient("http://www.../")
  var request = new RestRequest ("demo/jsondbcount.php",Method.GET);
  request.RequestFormat = DataFormat.Json;
  
  var response = client.Execute (request);
  RestSharp.Deserializers.JsonDeserializer deserialCount = new JsonDeserializer();
  dbCount =  deserialCount.Deserialize&lt;DBCount&gt; (response);
  </code></pre>
  
  <p>Here's the invalid cast error:</p>
  
  <blockquote>
    <p>"Cannot cast from source type to destination type"</p>
  </blockquote>
  
  <p>If anyone can point me to a basic, simple example of using <code>RestSharp</code> to deserialize a simple object I'd be very grateful.  I've searched everywhere for a basic code sample.</p>
  
  <p>Thanks</p>