title: C# adding JSON string to a List
body: <p>So in my app I have to get a JSON string.
  It can be a City or a List of Cities.</p>
  
  <p>In the City class I have this:</p>
  
  <pre><code>public class City
  {
      public string id { get; set; }
      public string country { get; set; }
      public string region { get; set; }
      public string city { get; set; }
      public string latitude { get; set; }
      public string longitude { get; set; }
      public string comment { get; set; }
      public bool wasThereAnError { get; set; }
  
      public class CityResponse
      {
          public string status { get; set; }
          public string message { get; set; }
          //public City result { get; set; }
          public List&lt;City&gt; result { get; set; }
      }
  </code></pre>
  
  <p>So it uses the List result to store data.
  This works fine when I get a JSON array back, it stores them all easily.
  However if I just query for 1 city, I get an exception about it needing an array.
  Here is the code for my call:</p>
  
  <pre><code>    async private Task&lt;City.CityResponse&gt; GetCityInformation(string url)
      {
          var client = new HttpClient();
          var response = await client.GetAsync(new Uri(url));
          string result = await response.Content.ReadAsStringAsync();
          var cityRoot = JsonConvert.DeserializeObject&lt;City.CityResponse&gt;(result);
  
          return cityRoot;
      }
  </code></pre>
  
  <p>Is it possible for me to store 1 city in the list too? Or do I need to make a seperate cities class or how do I go about this? Thanks</p>