title: Map JSON date keys to a struct in Swift 4
body: <p>I am trying to parse this JSON:</p>
  
  <pre><code>{
  "MetaData": {
      "1. Information": "Daily Time Series with Splits and Dividend Events",
      "2. Symbol": "AAPL",
      "3. Last Refreshed": "2018-06-08",
      "4. Output Size": "Compact",
      "5. Time Zone": "US/Eastern"
  },
  "TimeSeries": {
      "2018-06-08": {
          "1. open": "191.1700",
          "2. high": "192.0000",
          "3. low": "189.7700",
          "4. close": "191.7000",
          "5. adjusted close": "191.7000",
          "6. volume": "26656799",
          "7. dividend amount": "0.0000",
          "8. split coefficient": "1.0000"
      },
      "2018-06-07": {
          "1. open": "194.1400",
          "2. high": "194.2000",
          "3. low": "192.3350",
          "4. close": "193.4600",
          "5. adjusted close": "193.4600",
          "6. volume": "21347180",
          "7. dividend amount": "0.0000",
          "8. split coefficient": "1.0000"
      },
      "2018-06-06": {
          "1. open": "193.6300",
          "2. high": "194.0800",
          "3. low": "191.9200",
          "4. close": "193.9800",
          "5. adjusted close": "193.9800",
          "6. volume": "20933619",
          "7. dividend amount": "0.0000",
          "8. split coefficient": "1.0000"
      },
          }
  }
  </code></pre>
  
  <p>I want to conform to structs like this:</p>
  
  <pre><code> struct Stocks: Decodable {
      struct Meta: Decodable {
          let info: String
          let symbol: String
          let last: String
          let size: String
          let time: String
          enum CodingKeys: String, CodingKey {
              case info = "1. Information"
              case symbol = "2. Symbol"
              case last = "3. Last Refreshed"
              case size = "4. Output Size"
              case time = "5. Time Zone"
          }
      }
  
      struct Time:  Decodable {
          let date: String
          let price = Prices()
  
          struct Prices: Decodable {
              var open: Int?
              var high: Int?
              var low: Int?
              var close: Int?
              enum  CodingKeys: String, CodingKey {
                  case open = "1. open"
                  case high = "2. high"
                  case low = "3. low"
                  case close = "4. close"
              }
          }
      }
      let MetaData: Meta
      let TimeSeries: Time
  
  
  }
  </code></pre>
  
  <p>For the MetaData part it works well.
  But for the timeseries part I do not know how to get past the dates without just iterating over the TimeSeries data.</p>
  
  <p>I would like to know if there is a way to map this part to a struct:</p>
  
  <pre><code> "TimeSeries": {
      "2018-06-08": {
          "1. open": "191.1700",
          "2. high": "192.0000",
          "3. low": "189.7700",
          "4. close": "191.7000",
          "5. adjusted close": "191.7000",
          "6. volume": "26656799",
          "7. dividend amount": "0.0000",
          "8. split coefficient": "1.0000"
      },
      "2018-06-07": {
          "1. open": "194.1400",
          "2. high": "194.2000",
          "3. low": "192.3350",
          "4. close": "193.4600",
          "5. adjusted close": "193.4600",
          "6. volume": "21347180",
          "7. dividend amount": "0.0000",
          "8. split coefficient": "1.0000"
      },
      "2018-06-06": {
          "1. open": "193.6300",
          "2. high": "194.0800",
          "3. low": "191.9200",
          "4. close": "193.9800",
          "5. adjusted close": "193.9800",
          "6. volume": "20933619",
          "7. dividend amount": "0.0000",
          "8. split coefficient": "1.0000"
      },
          }
  }
  </code></pre>
  
  <p>The issue seems to be the date keys that keeps changing - how can you map these to a struct?</p>