title: How to map JSON String to model class using Object Mapper in swift
body: <p>My model class is like:</p>
  
  <pre><code>class CalendarTaskModel: Mappable {
  
       var kpiColor: String?
       var kpi: String?
       var date: String?
  
       required init?(map: Map) {
          //Code here
       }
  
      func mapping(map: Map) {
           kpiColor &lt;- map["kpiColor"]
           kpi &lt;- map["kpi"]
           date &lt;- map["date"]
       }
   }
  </code></pre>
  
  <p>I have an object mapped with a model class.</p>
  
  <pre><code>var taskDetails: [CalendarTaskModel]?
  </code></pre>
  
  <p>As my object is of array type so I Want to map JSON string to object using ObjectMapper like the code below.</p>
  
  <pre><code>code 1: taskDetails = Mapper&lt;[CalendarTaskModel]&gt;().map(JSONString: jsonStr)
  //
  code 2: taskDetails = Mapper&lt;CalendarTaskModel&gt;().map(JSONString: jsonStr)
  </code></pre>
  
  <p>but I am getting errors <a href="https://i.stack.imgur.com/9Oshs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Oshs.png" alt="enter image description here"></a> &amp;&amp; <a href="https://i.stack.imgur.com/Wxqsc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wxqsc.png" alt="enter image description here"></a> Please suggest how to do this?
  Thanks in advance.</p>