title: Index of JSON Array Swift
body: <p>I am using this library to parse an API endpoint that returns an array: <a href="https://github.com/SwiftyJSON/SwiftyJSON" rel="nofollow">https://github.com/SwiftyJSON/SwiftyJSON</a></p>
  
  <p>I am grabbing an array fetched from a JSON response and I am trying to feed it into a table.</p>
  
  <p>Right after my class in my view controller is declared, I have</p>
  
  <pre><code>var fetched_data:JSON = []
  </code></pre>
  
  <p>Inside of my viewDidLoad method:</p>
  
  <pre><code>let endpoint = NSURL(string: "http://example.com/api")
          let data = NSData(contentsOfURL: endpoint!)
          let json = JSON(data: data!)
          fetched_data = json["posts"].arrayValue
  </code></pre>
  
  <p>To feed the table, I have: </p>
  
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
          let cell: UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell1")! as UITableViewCell
          cell.textLabel?.text = self.fetched_data[indexPath.row]
          return cell      
      }
  </code></pre>
  
  <p>I am getting this error, when trying to set the cell textLabel:</p>
  
  <pre><code>Cannot subscript a value of a type ‘JSON’ with an index type of ‘Int’
  </code></pre>
  
  <p><strong>How do I do this properly and get this to work?</strong></p>