title: Woocommerce JSON data is not showing in collection view
body: <p>**</p>
  
  <blockquote>
    <p>i was trying to load woo commerce product list in my collection view.
    i am gating data from server also able to print data. but when i go to
    showing data in my collection view cell it's not showing.</p>
  </blockquote>
  
  <p>**</p>
  
  <p>here what i have done</p>
  
  <pre><code>var newArraivalArray = [AnyObject]()
  </code></pre>
  
  <p>Here i try to get Json data array </p>
  
  <pre><code>  Alamofire.request("https://infinitymegamall.com/wp-json/wc/v2/products?after=2016-12-19T16:39:57-08:00", parameters:
              ["consumer_key":"*******", "consumer_secret":"*******"])
              .responseJSON{  response in
  
            if let json = response.result.value {
                      newArraivalArray = json as! [AnyObject]
                      print(json)
                  }
        self.collectionView.reloadData()
  
  }
  </code></pre>
  
  <p>for number of item in collectionview</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
  
  return newArraivalArray.count
  }
  </code></pre>
  
  <p>for showing data in collection view.</p>
  
  <pre><code>func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
   let cellC = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath as IndexPath) as! NewArraivelCollectionViewCell
   let productName = newArraivalArray[indexPath.row]["name"]
             cellC.name.text = productName as? String
  
  return cellC
  }
  </code></pre>
  
  <p>but i did't see any data in my collection view cell.but some how product name is not showing in my cell. i have no idea what happening.</p>
  
  <p>here what error i get <a href="https://i.stack.imgur.com/jybbj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jybbj.png" alt="enter image description here"></a></p>
  
  <p>Here is my json Data </p>
  
  <pre><code>[
        {
              "id": 57678,
              "name": "Mens Formal Printed Shirt",
              "slug": "mens-formal-printed-shirt-3",
              "permalink": "https://infinitymegamall.com/product/mens-formal-printed-shirt-3/",
              "date_created": "2018-01-10T18:29:58",
              "date_created_gmt": "2018-01-10T12:29:58",
              "date_modified": "2018-01-10T18:29:58",
              "date_modified_gmt": "2018-01-10T12:29:58",
              "type": "variable",
              "status": "publish",
              "featured": false,
              "catalog_visibility": "visible",
              "description": "&lt;p&gt;Code:-4105110568&lt;/p&gt;\n",
              "short_description": "&lt;p&gt;Code:-4105110568&lt;/p&gt;\n",
              "sku": "4105110568",
              "price": "1971",
              "regular_price": "",
              "sale_price": "",
              "date_on_sale_from": null,
              "date_on_sale_from_gmt": null,
              "date_on_sale_to": null,
              "date_on_sale_to_gmt": null,
              "price_html": "&lt;div class=\"product-price\"&gt;&lt;del&gt;&lt;span class=\"woocommerce-Price-amount amount\"&gt;&lt;span class=\"woocommerce-Price-currencySymbol\"&gt;&amp;#2547;&amp;nbsp;&lt;/span&gt;&amp;nbsp;2,190.00&lt;/span&gt;&lt;/del&gt; &lt;ins&gt;&lt;span class=\"woocommerce-Price-amount amount\"&gt;&lt;span class=\"woocommerce-Price-currencySymbol\"&gt;&amp;#2547;&amp;nbsp;&lt;/span&gt;&amp;nbsp;1,971.00&lt;/span&gt;&lt;/ins&gt;&lt;/div&gt;",
              "on_sale": true,
              "purchasable": true,
              "total_sales": 0,
              "virtual": false,
              "downloadable": false,
              "downloads": [],
              "download_limit": -1,
              "download_expiry": -1,
              "external_url": "",
              "button_text": "",
              "tax_status": "taxable",
              "tax_class": "",
              "manage_stock": false,
              "stock_quantity": null,
              "in_stock": true,
              "backorders": "no",
              "backorders_allowed": false,
              "backordered": false,
              "sold_individually": false,
              "weight": "",
              "dimensions": {
                  "length": "",
                  "width": "",
                  "height": ""
              },
              "shipping_required": true,
              "shipping_taxable": true,
              "shipping_class": "",
              "shipping_class_id": 0,
              "reviews_allowed": true,
              "average_rating": "0.00",
              "rating_count": 0,
              "related_ids": [
                  47912,
                  47785,
                  47886,
                  48373,
                  48708
              ],
              "upsell_ids": [],
              "cross_sell_ids": [],
              "parent_id": 0,
              "purchase_note": "",
              "categories": [
                  {
                      "id": 220,
                      "name": "Full Sleeve",
                      "slug": "full-sleeve-casual"
                  },
                  {
                      "id": 37,
                      "name": "Men",
                      "slug": "men"
                  },
                  {
                      "id": 53,
                      "name": "Shirt",
                      "slug": "shirt"
                  },
                  {
                      "id": 91,
                      "name": "Casual",
                      "slug": "casual"
                  }
              ],
              "tags": [],
              "images": [
                  {
                      "id": 57683,
                      "date_created": "2018-01-10T18:25:13",
                      "date_created_gmt": "2018-01-10T12:25:13",
                      "date_modified": "2018-01-10T18:25:13",
                      "date_modified_gmt": "2018-01-10T12:25:13",
                      "src": "https://infinitymegamall.com/wp-content/uploads/2018/01/Mens-Formal-Printed-Shirt-Sky-Print-4105110568-2190tk-2.png",
                      "name": "Mens Formal Printed Shirt-Sky Print&amp;#8212;&amp;#8211;4105110568&amp;#8212;-2,190tk (2)",
                      "alt": "",
                      "position": 0
                  },
                  {
                      "id": 57684,
                      "date_created": "2018-01-10T18:25:33",
                      "date_created_gmt": "2018-01-10T12:25:33",
                      "date_modified": "2018-01-10T18:25:33",
                      "date_modified_gmt": "2018-01-10T12:25:33",
                      "src": "https://infinitymegamall.com/wp-content/uploads/2018/01/Mens-Formal-Printed-Shirt-Sky-Print-4105110568-2190tk-1.png",
                      "name": "Mens Formal Printed Shirt-Sky Print&amp;#8212;&amp;#8211;4105110568&amp;#8212;-2,190tk (1)",
                      "alt": "",
                      "position": 1
                  }
              ],
              "attributes": [
                  {
                      "id": 3,
                      "name": "Size",
                      "position": 0,
                      "visible": true,
                      "variation": true,
                      "options": [
                          "L",
                          "M",
                          "XL"
                      ]
                  }
              ],
              "default_attributes": [],
              "variations": [
                  57682,
                  57680,
                  57681
              ],
              "grouped_products": [],
              "menu_order": 0,
              "meta_data": [
                  {
                      "id": 481056,
                      "key": "_vc_post_settings",
                      "value": {
                          "vc_grid_id": []
                      }
                  },
                  {
                      "id": 481216,
                      "key": "des_content",
                      "value": "Code:-4105110568"
                  },
                  {
                      "id": 481217,
                      "key": "trending_product",
                      "value": "off"
                  },
                  {
                      "id": 481269,
                      "key": "post_views",
                      "value": "3"
                  }
              ],
              "_links": {
                  "self": [
                      {
                          "href": "https://infinitymegamall.com/wp-json/wc/v2/products/57678"
                      }
                  ],
                  "collection": [
                      {
                          "href": "https://infinitymegamall.com/wp-json/wc/v2/products"
                      }
                  ]
              }
          },
          {
              "id": 57672,
              "name": "Mens Formal Printed Shirt",
              "slug": "mens-formal-printed-shirt-2",
              "permalink": "https://infinitymegamall.com/product/mens-formal-printed-shirt-2/",
              "date_created": "2018-01-10T18:12:29",
              "date_created_gmt": "2018-01-10T12:12:29",
              "date_modified": "2018-01-10T18:12:29",
              "date_modified_gmt": "2018-01-10T12:12:29",
              "type": "variable",
              "status": "publish",
              "featured": false,
              "catalog_visibility": "visible",
              "description": "&lt;p&gt;Code:-4105110563&lt;/p&gt;\n",
              "short_description": "&lt;p&gt;Code:-4105110563&lt;/p&gt;\n",
              "sku": "4105110563",
              "price": "1971",
              "regular_price": "",
              "sale_price": "",
              "date_on_sale_from": null,
              "date_on_sale_from_gmt": null,
              "date_on_sale_to": null,
              "date_on_sale_to_gmt": null,
              "price_html": "&lt;div class=\"product-price\"&gt;&lt;del&gt;&lt;span class=\"woocommerce-Price-amount amount\"&gt;&lt;span class=\"woocommerce-Price-currencySymbol\"&gt;&amp;#2547;&amp;nbsp;&lt;/span&gt;&amp;nbsp;2,190.00&lt;/span&gt;&lt;/del&gt; &lt;ins&gt;&lt;span class=\"woocommerce-Price-amount amount\"&gt;&lt;span class=\"woocommerce-Price-currencySymbol\"&gt;&amp;#2547;&amp;nbsp;&lt;/span&gt;&amp;nbsp;1,971.00&lt;/span&gt;&lt;/ins&gt;&lt;/div&gt;",
              "on_sale": true,
              "purchasable": true,
              "total_sales": 0,
              "virtual": false,
              "downloadable": false,
              "downloads": [],
              "download_limit": -1,
              "download_expiry": -1,
              "external_url": "",
              "button_text": "",
              "tax_status": "taxable",
              "tax_class": "",
              "manage_stock": false,
              "stock_quantity": null,
              "in_stock": true,
              "backorders": "no",
              "backorders_allowed": false,
              "backordered": false,
              "sold_individually": false,
              "weight": "",
              "dimensions": {
                  "length": "",
                  "width": "",
                  "height": ""
              },
              "shipping_required": true,
              "shipping_taxable": true,
              "shipping_class": "",
              "shipping_class_id": 0,
              "reviews_allowed": true,
              "average_rating": "0.00",
              "rating_count": 0,
              "related_ids": [
                  48222,
                  48373,
                  47892,
                  50683,
                  48377
              ],
              "upsell_ids": [],
              "cross_sell_ids": [],
              "parent_id": 0,
              "purchase_note": "",
              "categories": [
                  {
                      "id": 220,
                      "name": "Full Sleeve",
                      "slug": "full-sleeve-casual"
                  },
                  {
                      "id": 37,
                      "name": "Men",
                      "slug": "men"
                  },
                  {
                      "id": 53,
                      "name": "Shirt",
                      "slug": "shirt"
                  },
                  {
                      "id": 91,
                      "name": "Casual",
                      "slug": "casual"
                  }
              ],
              "tags": [],
              "images": [
                  {
                      "id": 57676,
                      "date_created": "2018-01-10T18:07:45",
                      "date_created_gmt": "2018-01-10T12:07:45",
                      "date_modified": "2018-01-10T18:07:45",
                      "date_modified_gmt": "2018-01-10T12:07:45",
                      "src": "https://infinitymegamall.com/wp-content/uploads/2018/01/Mens-Formal-Printed-Shirt-Maroon-4105110563-2190tk-2.png",
                      "name": "Mens Formal Printed Shirt-Maroon&amp;#8212;&amp;#8212;4105110563&amp;#8212;-2,190tk (2)",
                      "alt": "",
                      "position": 0
                  },
                  {
                      "id": 57677,
                      "date_created": "2018-01-10T18:08:25",
                      "date_created_gmt": "2018-01-10T12:08:25",
                      "date_modified": "2018-01-10T18:08:25",
                      "date_modified_gmt": "2018-01-10T12:08:25",
                      "src": "https://infinitymegamall.com/wp-content/uploads/2018/01/Mens-Formal-Printed-Shirt-Maroon-4105110563-2190tk-1.png",
                      "name": "Mens Formal Printed Shirt-Maroon&amp;#8212;&amp;#8212;4105110563&amp;#8212;-2,190tk (1)",
                      "alt": "",
                      "position": 1
                  }
              ],
              "attributes": [
                  {
                      "id": 3,
                      "name": "Size",
                      "position": 0,
                      "visible": true,
                      "variation": true,
                      "options": [
                          "L",
                          "M",
                          "XL"
                      ]
                  }
              ],
              "default_attributes": [],
              "variations": [
                  57673,
                  57674,
                  57675
              ],
              "grouped_products": [],
              "menu_order": 0,
              "meta_data": [
                  {
                      "id": 480903,
                      "key": "_vc_post_settings",
                      "value": {
                          "vc_grid_id": []
                      }
                  },
                  {
                      "id": 481053,
                      "key": "des_content",
                      "value": "Code:-4105110563"
                  },
                  {
                      "id": 481054,
                      "key": "trending_product",
                      "value": "off"
                  },
                  {
                      "id": 481055,
                      "key": "post_views",
                      "value": "3"
                  }
              ],
              "_links": {
                  "self": [
                      {
                          "href": "https://infinitymegamall.com/wp-json/wc/v2/products/57672"
                      }
                  ],
                  "collection": [
                      {
                          "href": "https://infinitymegamall.com/wp-json/wc/v2/products"
                      }
                  ]
              }
          }]
  </code></pre>