Swift 4 JSON Decoding Error with Collection View Cell : I am trying to build an iOS app in Xcode 9.2, Swift 4 that uses a Collection View Cell to display each of the categories in the JSON file. I was working through this tutorial as an example - https://www.youtube.com/watch?v=hPJaQ2Fh7Ao, but I am getting an error:

typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil))

I have tried several different things, but I am stuck (and new to this). Any suggestions as to what I am missing or doing wrong would be great. Thanks!

JSON API:

    {
      "category": [
        {
          "id": 216,
          "title": "Spring"
        },
        {
          "id": 219,
          "title": "Earth Day"
        },
        {
          "id": 114,
          "title": "Admin. Professionals' Day"
        }
      ]
    }

ViewController.swift:

    import UIKit
    
    struct Category: Codable {
        let category: [CategoryItem]
    }
    
    struct CategoryItem: Codable {
        let id: Int
        let title: String
        
        enum CodingKeys: String, CodingKey {
            case id, title
        }
    }
    
    class ViewController: UIViewController, UICollectionViewDataSource {
        
        var categories = [Category]()
    
        @IBOutlet weak var collectionView: UICollectionView!
        
        override func viewDidLoad() {
            super.viewDidLoad()
            
            collectionView.dataSource = self
            
            let jsonUrlString = "https://apis.*************/***/****/********"
            guard let url = URL(string: jsonUrlString) else { return }
            
            URLSession.shared.dataTask(with: url) { (data, response, err) in
                guard let data = data else { return }
    
                if err == nil {
                    do {
                        let decoder = JSONDecoder()
                        let ecardcategory = try decoder.decode([Category].self, from: data)
                        self.categories = ecardcategory
                    } catch let err {
                        print("Err", err)
                    }
    
                    DispatchQueue.main.async {
                        //print(self.categories.count)
                        self.collectionView.reloadData()
                    }
                }
            }.resume()
            
        }
        
        func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
            return categories.count
        }
    
        func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "customCell", for: indexPath) as? CustomCollectionViewCell
            //cell?.nameLbl.text = categories[indexPath.row].title
            return cell!
        }
    }

