title: Swift ObjectMapper - array mapping
body: <p>I have a JSON response like: </p>
  
  <pre><code>      {
          total_count: 155,
          size: 75,
          authors: [{ name: "test1"
                      id: 1
  
                   },
                   {name: "test2"
                      id: 2
                   }]
        }
  </code></pre>
  
  <p>I created my object model and use objectMapper for mapping/parsing this json.</p>
  
  <pre><code>import Foundation
  import SwiftyJSON
  import ObjectMapper
  
  class Author: Mappable {
      var id: Int!
      var name: String!
  
      required init?(map: Map) {
  
      }
  
      func mapping(map: Map) {
          self.id &lt;- map["id"]
          self.name &lt;- map["name"]
      }
  
      static func fromJSONArray(_ json: JSON) -&gt; [Author] {
          var authorArray: [Author] = []
          if json.count &gt; 0 {
              for item in json["authors"]{
                  print(item)
                  authorArray.append(Mapper&lt;Author&gt;().map(JSONObject: item)!)
              }
          }
          return authorArray
      }
  </code></pre>
  
  <p>With print(item) I can see the objects but, I can't make append work. It is giving "<code>Unexpectedly found nil while unwrapping an Optional value</code>" error.</p>