title: Swift: Convert JSON String to Array of Custom Object with ObjectMapper
body: <p>I am currently using the ObjectMapper for Swift (see: <a href="https://github.com/Hearst-DD/ObjectMapper/">https://github.com/Hearst-DD/ObjectMapper/</a>) to convert a <code>String</code> from a HTTP Request to an object of a custom class. The JSON I get from the request is a JSON Array, and I would like to convert this to an <code>Array</code> from type <code>CustomObject</code>.</p>
  
  <p>I have tried it like this:</p>
  
  <pre><code>var object = Mapper&lt;Array&lt;CustomObject&gt;&gt;().map(string: json)
  </code></pre>
  
  <p>But then I get an error: <code>Can not find member 'map'</code>.</p>
  
  <p>How should this be done?</p>
  
  <p>Edit: this is my <code>CustomObject</code> Class, from now called <code>ProductVariant</code>:</p>
  
  <pre><code>public class ProductVariant: Mappable {
  
      /* Attributes */
  
      public var id = 0
  //    var size : Size = nil
      public var SKU = ""
      public var stock = 0
      public var numberOfDefects = 0
  
      /* Constructors */
  
      public init?() {
          // Empty Constructor
      }
  
      required public init?(_ map: Map) {
          mapping(map)
      }
  
      /* Methods */
  
      public func mapping(map: Map) {
          id &lt;- map["id"]
          SKU &lt;- map["SKU"]
          stock &lt;- map["stock"]
          numberOfDefects &lt;- map["numberOfDefects"]
      }
  }
  </code></pre>