title: Creating JSON with dynamic keys in c#
body: <p>I am trying to replicate the following JSON structure:</p>
  
  <pre><code>{"result_content": {
      "data": {
           "city_name" : "Beverly Hills",
           "2014-06-05T00:00:00": {
           "morning_low": "20",
           "daytime_high": "40"
           },
           "2014-06-06T00:00:00": {
           "morning_low": "21",
           "daytime_high": "41"
           },
           "2014-06-07T00:00:00": {
           "morning_low": "22",
           "daytime_high": "42"
           },
          "2014-06-08T00:00:00": {
          "morning_low": "23",
          "daytime_high": "43"
          },
          "2014-06-09T00:00:00": {
          "morning_low": "24",
          "daytime_high": "44"
          }
        }
      }
    }
  </code></pre>
  
  <p>But I can't figure out how create the keys to be dynamic using C#.</p>
  
  <p>Here are my object class's</p>
  
  <pre><code>public class Day
  {
      public string morning_low { get; set; }
      public string daytime_high { get; set; }
  }
  
  public class Data
  {
      public string city_name { get; set; }
      public List&lt;Day&gt; days { get; set; }
  }
  
  public class ResultContent
  {
      public Data data { get; set; }
  }
  </code></pre>
  
  <p>And here is how im building it all:</p>
  
  <pre><code>            ResultContent content = new ResultContent();
              content.data = new Data();
              content.data.city_name = results.Body.GetCityForecastByZIPResponse.GetCityForecastByZIPResult.City;
  
              foreach (Forecast day in results.Body.GetCityForecastByZIPResponse.GetCityForecastByZIPResult.ForecastResult.Forecast){
                  Day x = new Day();
                  x.daytime_high = day.Temperatures.DaytimeHigh;
                  x.morning_low = day.Temperatures.MorningLow;
                  content.data.days.Add(x);
              }
  
              return JsonConvert.SerializeObject(content);
  </code></pre>
  
  <p>This just returns a JSON array of days which is not what I want. I have the DateTime in my results object.</p>