title: Using Swift 4 Codable Protocol with Unknown Dictionary Keys
body: <p>I am working with NASA's <a href="https://api.nasa.gov/neo/?api_key=DEMO_KEY#!/rest%2Fv1%2Ffeed/retrieveNearEarthObjectFeed" rel="nofollow noreferrer">Near Earth Object Web Service</a> to retrieve data to be displayed in an application. I understand how to use Swift 4's <code>Codable</code> protocol, but I do not understand how to map part of the response.</p>
  
  <p>Using <a href="https://paw.cloud" rel="nofollow noreferrer">Paw</a>, I inspected the response from the API:</p>
  
  <p><a href="https://i.stack.imgur.com/GFxsa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GFxsa.png" alt="Image of API response data"></a></p>
  
  <p>As you can see, the <code>near_earth_objects</code> structure is a <code>Dictionary</code>, and the keys are dates. The issue is that the URL parameters are dates, so these date structures will change, depending on the day of the request. Therefore, I do not know how I can create properties to be automatically mapped when using the <code>Codable</code> protocol. </p>
  
  <p>The data that I am trying to get to inside of these structures are <code>Array</code>s that contain <code>Dictionary</code>s:</p>
  
  <p><a href="https://i.stack.imgur.com/T2kDj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T2kDj.png" alt="Image of API response data"></a></p>
  
  <p>How can I have my model object conform to the <code>Codable</code> protocol and map these structures when the dates will change as the dates of the requests change?</p>