Could not cast value of type '__NSDictionaryM' (0x10820e4f8) to 'NSArray' (0x10820d008)

I am working on a project and have reached a stage where I want to display data from a web service in a table view. but when I build my project I am getting the error:

Could not cast value of type '__NSDictionaryM' (0x10820e4f8) to 'NSArray' (0x10820d008).

This code.

        //get the values from sql/Json
        let url = NSURL(string: "https://xxx.xxxxxx.co/api/shopscategories")

        let data = NSData(contentsOf: url! as URL)
        var tmpValues = try! JSONSerialization.jsonObject(with: data! as Data, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSArray
        tmpValues = tmpValues.reversed() as NSArray
        reloadInputViews()

        for candidate in tmpValues {
            if let cdict = candidate as? NSDictionary {

                //Name is the column name in sql/json
                let names = cdict["name"]
                let ids = cdict["id"]
                self.values.append("\(ids ?? Int.self) \(names ?? String.self)" as AnyObject)

            }
        }

The json data is as follows:

"data": [
{
"id": 1,
"name": "pants",
"created_at": "2018-05-16 03:59:21",
"updated_at": "2018-05-16 03:59:21"
},
{
"id": 2,
"name": "shirts",
"created_at": "2018-05-16 03:59:32",
"updated_at": "2018-05-16 03:59:32"
},
{
"id": 3,
"name": "electronics",
"created_at": "2018-05-16 03:59:48",
"updated_at": "2018-05-16 03:59:48"
},
{
"id": 4,
"name": "bag",
"created_at": "2018-05-16 04:00:08",
"updated_at": "2018-05-16 04:00:08"
}
]
}