title: Implementing deserialization with RestSharp and Newtonsoft.Json
body: <p>I am rather new to c# but I am building something to help me at work. We have a REST API which I am trying to tap into but I am having issues when it comes to deserializing the response.
  My code:</p>
  
  <pre><code>namespace BSRestCleint
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
          string key = "xxxxxxxx";
          string endPoint = "https://api.broadsign.com:10889/rest";
          private void bRun_Click(object sender, EventArgs e)
          {
              var client = new RestClient(endPoint);
              var request = new RestRequest("/host/v14/by_id", Method.GET);
              request.AddHeader("accept", "application/json");
              request.AddHeader("Authorization", "Bearer " + key);
              request.AddParameter("domain_id", "103947039");
              request.AddParameter("ids", "195392183");
              request.OnBeforeDeserialization = resp =&gt; { resp.ContentType = "application/json"; };
              request.RequestFormat = DataFormat.Json;
              var response = client.Execute&lt;Host&gt;(request);
              var host = JsonConvert.DeserializeObject&lt;Host&gt;(response.Content);
              oResponse.Text = host.Name;
  
          }
      }
  }
  </code></pre>
  
  <p>And this is my class: </p>
  
  <pre><code>namespace BSRestCleint
  {
      using System;
      using System.Collections.Generic;
  
      using System.Globalization;
      using Newtonsoft.Json;
      using Newtonsoft.Json.Converters;
      using System.Runtime.Serialization.Json;
      using System.IO;
  
      public partial class Host
      {
          [JsonProperty("config_profile_bag_id")]
          public long ConfigProfileBagId { get; set; }
  
          [JsonProperty("container_id")]
          public long ContainerId { get; set; }
  
          [JsonProperty("db_pickup_tm_utc")]
          public string DbPickupTmUtc { get; set; }
  
          [JsonProperty("discovery_status")]
          public long DiscoveryStatus { get; set; }
  
          [JsonProperty("display_unit_id")]
          public long DisplayUnitId { get; set; }
  
          [JsonProperty("domain_id")]
          public long DomainId { get; set; }
  
          [JsonProperty("geolocation")]
          public string Geolocation { get; set; }
  
          [JsonProperty("id")]
          public long Id { get; set; }
  
          [JsonProperty("name")]
          public string Name { get; set; }
  
          [JsonProperty("nscreens")]
          public long Nscreens { get; set; }
  
          [JsonProperty("public_key_fingerprint")]
          public string PublicKeyFingerprint { get; set; }
  
          [JsonProperty("remote_clear_db_tm_utc")]
          public string RemoteClearDbTmUtc { get; set; }
  
          [JsonProperty("remote_reboot_tm_utc")]
          public string RemoteRebootTmUtc { get; set; }
  
          [JsonProperty("volume")]
          public long Volume { get; set; }
      }
  }
  </code></pre>
  
  <p>Finally the returning json:</p>
  
  <pre><code>{  
     "not_modified_since":"2018-06-05T22:22:18Z",
     "host":[  
        {  
           "active":true,
           "config_profile_bag_id":0,
           "container_id":0,
           "db_pickup_tm_utc":"2018-01-11T10:12:55",
           "discovery_status":0,
           "display_unit_id":0,
           "domain_id":103947039,
           "geolocation":"(0,0)",
           "id":195392183,
           "license_end_date":null,
           "licensed":true,
           "name":"Broadsign Services - Mathias - 16x64",
           "nscreens":0,
           "primary_mac_address":"00:0c:29:e0:e6:22",
           "public_key_fingerprint":"REDACTED",
           "remote_clear_db_tm_utc":"1970-01-01T00:00:00",
           "remote_reboot_tm_utc":"2017-12-12T10:17:23",
           "secondary_mac_address":"",
           "volume":-1
        }
     ]
  }
  </code></pre>
  
  <p>I know that if I only process this part my code works:</p>
  
  <pre><code>{  
       "active":true,
       "config_profile_bag_id":0,
       "container_id":0,
       "db_pickup_tm_utc":"2018-01-11T10:12:55",
       "discovery_status":0,
       "display_unit_id":0,
       "domain_id":103947039,
       "geolocation":"(0,0)",
       "id":195392183,
       "license_end_date":null,
       "licensed":true,
       "name":"Broadsign Services - Mathias - 16x64",
       "nscreens":0,
       "primary_mac_address":"00:0c:29:e0:e6:22",
       "public_key_fingerprint":"REDACTED",
       "remote_clear_db_tm_utc":"1970-01-01T00:00:00",
       "remote_reboot_tm_utc":"2017-12-12T10:17:23",
       "secondary_mac_address":"",
       "volume":-1
  }
  </code></pre>
  
  <p>I'd like to know how I could make my code work to handle the whole json so that I don't need to regex the returning value. Some of the responses would return multiple instances unlike there where there's only 1. It's probably a very simple solution but my grasp of the language is rather minute as I am new to it.</p>
  
  <p>Any help would be appreciated.</p>