JSON serialization with Swift 3
<p>I am trying to to populate a table by filling an array from JSON data. I am using the code below but keep getting the error:</p>

<blockquote>
  <p>Type 'Any' has no subscript members</p>
</blockquote>

<p>on the following lines of code:</p>

<pre><code>self.tableData.append(jsonResult[i]["title"]! as! String)
self.tableImages.append(jsonResult[i]["image"]! as! String)
self.tableDesc.append(jsonResult[i]["description"]! as! String)
self.tableValidity.append(jsonResult[i]["validity"]! as! String)
</code></pre>

<p>My code:</p>

<pre><code> let str3 = Int(str2!)!
            let url = NSURL(string: "https://www.*****.php")!

            let task = URLSession.shared.dataTask(with: url as URL) { (data, response, error) -&gt; Void in
                if let urlContent = data {
                    do {

                        let jsonResult = try JSONSerialization.jsonObject(with: urlContent, options: JSONSerialization.ReadingOptions.mutableContainers)


                        print(str3)

                        var i = 0

                        while i &lt; str3 {
                            print(jsonResult[i]["title"]! as!String)
                            print(jsonResult[i]["image"]! as! String)

                            self.tableData.append(jsonResult[i]["title"]! as! String)
                            self.tableImages.append(jsonResult[i]["image"]! as! String)
                            self.tableDesc.append(jsonResult[i]["description"]! as! String)
                            self.tableValidity.append(jsonResult[i]["validity"]! as! String)

                            i = i + 1

                        }

                    } catch {
                        print("JSON serialization failed")
                    }                    

                } else {                    
                    print("ERROR FOUND HERE")
                }                

                DispatchQueue.main.async(execute: { () -&gt; Void in

                    self.tableView.reloadData()

                })                                

            }

            task.resume()
</code></pre>