'Error CS0246 The type or namespace name 'JsonDeserializer' could not be found (RestSharp v107)

I get an error (after update RestSharp - v107) on the following line:

var contacts = new JsonDeserializer().Deserialize<List<Contact>>(response);

Error CS0246 The type or namespace name 'JsonDeserializer' could not be found (are you missing a using directive or an assembly reference?)

using NUnit.Framework;
using RestSharp;
using System.Text.Json;
using System;
using System.Collections.Generic;
using System.Net;

namespace ContactBook.ApiTests
{
public class ContactBookApiTests
{
    const string ApiBaseUrl = "URl/api";
    RestClient client;

    [SetUp]
    public void Setup()
    {
        this.client = new RestClient(ApiBaseUrl);
    }

    [Test]
    public void Test_ListContacts_CheckForSteveJobs()
    {
        // Arrange
        var request = new RestRequest("/contacts", Method.Get);

        // Act
        var response = this.client.ExecuteAsync(request);

        // Assert
        Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK));
        var contacts = new JsonDeserializer().Deserialize<List<Contact>>(response);
        Assert.That(contacts.Count, Is.GreaterThan(0));
        var firstContact = contacts[0];
        Assert.That(firstContact.firstName, Is.EqualTo("Steve"));
        Assert.That(firstContact.lastName, Is.EqualTo("Jobs"));
    }
    }


Solution 1:[1]

try this

 var response = this.client.ExecuteAsync(request).Result;

  //or better

var response = this.client.Execute(request);
....

 var contacts = JsonSerializer.Deserialize<List<Contact>>(response.Content);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1