title: Why does JsonConvert.DeserializeObject return an error: Exception: Value cannot be null. (Parameter 'source')
body: <p>I have a <code>public async Task GetCompaniesAsync()</code> that is coded like this:</p>
  <pre><code>public async Task GetCompaniesAsync()
  {
      _getCompaniesSuccessful = false;
  
      var result = await _http.GetAsync($&quot;https://somesite.com/api/companies&quot;);
  
      if (result.IsSuccessStatusCode)
      {
          // I split the code after the suggestion of @mjwills (thanks)
          var content = await result.Content.ReadAsStringAsync();
          var obj = JsonConvert.DeserializeObject&lt;StockMarket&gt;(content).Companies;
  
          // at this point, content.Length has a value (e.g. 24429)
          // but, obj is null (after JsonConvert)
  
          if (obj != null)
          {
              _companies = obj.ToList();
              _getCompaniesSuccessful = true;
          }
  }
  </code></pre>
  <p>And in some other class, I use the following code:</p>
  <pre><code>await MyService.GetCompaniesAsync();
                  
  if (MyService.GetCompaniesSuccessful)
  {
      foreach (var record in MyService.Companies)
      {
          await Context.Channel.SendMessageAsync($&quot;{record.TickerSymbol,-10}\t{record.CompanyName,-10}&quot;);
      }
  }
  </code></pre>
  <p>But when I get the following error: <em>Exception: Value cannot be null. (Parameter 'source')</em>
  Could it be that it has not yet finished retrieving the data? Please help...</p>
  <p>By the way, the webapi url returns JSON data, it looks like this:</p>
  <pre><code>{
      &quot;companies&quot;: [
          {
              &quot;ticker&quot;: &quot;HEY&quot;,
              &quot;name&quot;: &quot;Hey Corporation&quot;,
              &quot;status&quot;: &quot;open&quot;
          },
          {
              &quot;ticker&quot;: &quot;PER&quot;,
              &quot;name&quot;: &quot;Pears Corporation&quot;,
              &quot;status&quot;: &quot;close&quot;
          },
          {
              &quot;ticker&quot;: &quot;BRGR&quot;,
              &quot;name&quot;: &quot;Burger Inc.&quot;,
              &quot;status&quot;: &quot;open&quot;
          },
      ]
  }           
  </code></pre>
  <p>And these are the StockMarket and Company classes:</p>
  <pre><code>public class StockMarket
  {
      public StockMarket()
      {
      }
  
      public ICollection&lt;Company&gt; Companies { get; set; }
  }
  
  public class Company
  {
      public Company()
      {
          TickerSymbol = &quot;&quot;;
          CompanyName = &quot;&quot;;
          Status = &quot;&quot;;
      }
  
      public string TickerSymbol { get; set; }
      public string CompanyName { get; set; }
      public string Status { get; set; }
  }
  </code></pre>