title: Swift Codable expected to decode Dictionary<String, Any>but found a string/data instead
body: <p>I have been working with the <code>Codable</code> protocol</p>
  
  <p>Here is my <code>JSON</code> file :</p>
  
  <pre><code>    {  
     "Adress":[  
  
     ],
     "Object":[  
        {  
           "next-date":"2017-10-30T11:00:00Z",
           "text-sample":"Some text",
           "image-path":[  
              "photo1.png",
              "photo2.png"
           ],
           "email":"john.doe@test.com",
           "id":"27"
        },
        {  
           "next-date":"2017-10-30T09:00:00Z",
           "text-sample":"Test Test",
           "image-path":[  
              "image1.png"
           ],
           "email":"name.lastename@doe.com",
           "id":"28"
        }
     ]
  }
  </code></pre>
  
  <p>I only have to focus on the Object array, and the "image-path" array can contain 0, 1, or 2 strings.</p>
  
  <p><strong>So here is my implementation:</strong></p>
  
  <pre><code>struct Result: Codable {
      let Object: [MyObject]
  }
  
  struct MyObject: Codable {
  
      let date: String
      let text: String
      let image: [String]
      let email: String
      let id: String
  
      enum CodingKeys: String, CodingKey {
          case date = "next-date"
          case text = "text-sample"
          case image = "image-path"
          case email = "email"
          case id = "id"
      }
  
      init() {
          self.date = ""
          self.text = ""
          self.image = []
          self.email = ""
          self.id = ""
      }
  }
  </code></pre>
  
  <p>I call it from my service class after requesting and getting the JSON data this way:</p>
  
  <pre><code>if let data = response.data {
                  let decoder = JSONDecoder()
                  let result = try! decoder.decode(Result, from: data)
                  dump(result.Object)
              }
  </code></pre>
  
  <p>Everything is working except the <code>[String]</code> for the <code>image</code> property</p>
  
  <p>But it can't compile, or I get an "Expected to decode..." error.</p>
  
  <p>How should I handle the nil/no data scenario?</p>