title: Swift 3.0 and web service
body: <p>Attempting to read our web service into a UITableViewController and it only returns the first record to the simulator.  So hoping that someone will be able to look at the code and guide me down the correct path. Ultimate goal is to get it into a UITableViewCell so I can format nicely but just looking to get all the records. </p>
  
  <p>Here is a view of the partial json file that will be returned.</p>
  
  <pre><code>{
  "Count":11518,
  "Result":[
      {
       "cuName": "#1",
       "charter_Num": 
       "16328","City": 
       "Jonesboro",
       "State_id": "GA",
       "cuName_location": "#1 - Jonesboro, GA"
       },
       {
       "cuName": "@lantec Financial",
       "charter_Num": "7965",
       "City": "Virginia Beach",
       "State_id": "VA",
       "cuName_location": "@lantec Financial - Virginia Beach, VA"
       }]
  }
  </code></pre>
  
  <p>Here is the code that reads in the json web service and attempts to parse and put in the table.</p>
  
  <pre><code>func get_data_from_url(_ link:String)
     {
      let url:URL = URL(string: link)!
      let session = URLSession.shared
  
      let request = NSMutableURLRequest(url: url)
      request.httpMethod = "GET"
      request.cachePolicy = NSURLRequest.CachePolicy.reloadIgnoringCacheData
  
  
      let task = session.dataTask(with: request as URLRequest, completionHandler: {
          (
          data, response, error) in
  
          guard let _:Data = data, let _:URLResponse = response  , error == nil else {
               return
          }
  
  
          self.extract_json(data!)
      })
  
      task.resume()
  }
  
  
  func extract_json(_ data: Data)
  {
      let json: Any?
  
      do
      {
          json = try JSONSerialization.jsonObject(with: data, options: [])
      }
      catch
      {
          return
      }
  
      //Commented out the following lines because it doesn't return anything when using the modified code that works
      //
      //        guard let data_list = json as? NSArray else
      //        {
      //            return
      //        }
  
      //This code works but only gives me the 1st record back
      if let cu_list = try? json as? [String:Any],
          let result = cu_list?["Result"] as? [[String:Any]],
          let charter_num = result[0]["charter_Num"] as? String,
          let value = result[0]["cuName_location"] as? String, result.count &gt; 0 {
          TableData.append(value + " (" + charter_num + ")")
      } else {
          print("bad json - do some recovery")
      }
  
      DispatchQueue.main.async(execute: {self.do_table_refresh()})
  
  }
  </code></pre>