title: Encodable: Flattening structures
body: <p>Let's say I have some type that has a JSON representation as such:</p>
  
  <pre><code>{
    "count": 3,
    "name": "Pianos",
    "type": "instrument",
    "id": 1,
  }
  </code></pre>
  
  <p>Let's say that I want to represent this as a Swift object that looks like this:</p>
  
  <pre><code>struct SomeObject: Codable { // this is the object I'd like to represent
    let id: Int
    let details: SomeDetails
  }
  
  struct SomeDetails: Codable {
    let count: Int
    let name: String
    let type: String
  }
  </code></pre>
  
  <p>Decoding this object is a no-brainer. But how would encoding work in this instance such that I can encode into a flat structure -- the same structure that I used to create this object and have shared in the JSON example above?</p>