title: How to check for json data exist?
body: <p>I generate a http request du get results via json. If there is a result everything works but if there is no result it crashes on trying to display the value into a textblock. I try this but it's not working </p>
  
  <pre><code>HttpClient client = new HttpClient();
  string url = "http://api.worldweatheronline.com/free/v1/search.ashx?q=" + Location + "&amp;format=json&amp;key=xxxx";
  string DatenURL = await client.GetStringAsync(url);
  RootObject apiData = JsonConvert.DeserializeObject&lt;RootObject&gt;(DatenURL);
  
  if (apiData.search_api.result[0] != null)
  {
      txt_Result1.Text = apiData.search_api.result[0].areaName[0].value.ToString();
  }
  </code></pre>
  
  <p>Here is the structure for json data:</p>
  
  <pre><code>public class AreaName
  {
      public string value { get; set; }
  }
  
  public class Country
  {
      public string value { get; set; }
  }
  
  public class Region
  {
      public string value { get; set; }
  }
  
  public class WeatherUrl
  {
      public string value { get; set; }
  }
  
  public class Result
  {
      public List&lt;AreaName&gt; areaName { get; set; }
      public List&lt;Country&gt; country { get; set; }
      public string latitude { get; set; }
      public string longitude { get; set; }
      public string population { get; set; }
      public List&lt;Region&gt; region { get; set; }
      public List&lt;WeatherUrl&gt; weatherUrl { get; set; }
  }
  
  public class SearchApi
  {
      public List&lt;Result&gt; result { get; set; }
  }
  
  public class RootObject
  {
      public SearchApi search_api { get; set; }
  }
  </code></pre>