title: iOS - Map a root JSON array with ObjectMapper in swift
body: <p>I use the library ObjectMapper to map json with my objects but I have some issues to map a root json Array.</p>
  
  <p>This is the received json :</p>
  
  <pre><code>[
     {
         CustomerId = "A000015",
         ...
     },
     {
         CustomerId = "A000016",
         ...
     },
     {
         CustomerId = "A000017",
         ...
     }
  ]
  </code></pre>
  
  <p>This is my object</p>
  
  <pre><code>class Customer : Mappable
  {
      var CustomerId : String? = nil
  
      class func newInstance(map: Map) -&gt; Mappable? {
          return Customer()
      }
  
      func mapping(map: Map) {
          CustomerId   &lt;- map["CustomerId"]
      }
  }
  </code></pre>
  
  <p>I map the json in my controller with</p>
  
  <pre><code>let json = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &amp;error) as! NSArray
  
  if (error != nil) {
      return completionHandler(nil, error)
  } else {
      var customers = Mapper&lt;Customer&gt;().map(json)
  }
  </code></pre>
  
  <p>But it doesn't work, I tried <code>Mapper&lt;[Customer]&gt;().map(json)</code> but it doesn't work too.
  Finally I tried to create a new swift object CustomerList containing a Customer array but it doesn't work.</p>
  
  <p>Do you have an idea of how to map json of a root array ?</p>
  
  <p>Thanks.</p>