title: How to Deserialize response from RestSharp using System.Text.Json?
body: <p>I am trying to write simple Get operation using RestSharp and trying to use System.Test.Json to deserialize the response.</p>
  <p>My Test method is as follows,</p>
  <pre><code>    [Test]
      public  void Test1()
      {
          var restClient = new RestClient(&quot;http://localhost:3333/&quot;);
  
          var request = new RestRequest(&quot;posts/{postid}&quot;, Method.Get);
  
          request.AddUrlSegment(&quot;postid&quot;, 1);
  
          var response = restClient.ExecuteGetAsync(request).GetAwaiter().GetResult();
  
          var deserial = JsonSerializer.Deserialize&lt;Posts&gt;(response);
      }
  </code></pre>
  <p>The Posts model class is as follows,</p>
  <pre><code>public class Posts
  {
      public string id { get; set; }
      public string title { get; set; }
      public string author { get; set; }
  }
  </code></pre>
  <p>But I am getting compellation error in line &quot;var deserial = JsonSerializer.Deserialize(response);&quot;</p>
  <p><em>cannot convert from 'RestSharp.RestResponse' to 'System.Text.Json.JsonDocument'    NUnitAPIPractice</em></p>
  <p>If I changed to</p>
  <p><code>var deserial = JsonSerializer.Deserialize&lt;Posts&gt;(response).ToSring();</code></p>
  <p>Then compilation issue is fixed but then after I execute the code then I am getting</p>
  <pre><code>    System.Text.Json.JsonException : 'R' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
        ----&gt; System.Text.Json.JsonReaderException : 'R' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
    Stack Trace: 
      ThrowHelper.ReThrowWithPath(ReadStack&amp; state, JsonReaderException ex)
  </code></pre>
  <p>Please tell me do I have to use special JSON conversion to convert the RestSharp response to JSON to solve this issue ? Thanks</p>