title: Swift 3 - Can't figure out how to create json Objects from jsonArray
body: <p>So I am having trouble with Swift 3. I am sending a get call to my server and I get the data back that I expect. However I can't figure out how to create objects from the jsonArray so I can easily access the data.</p>
  
  <p>This is my func so far:</p>
  
  <pre><code>func getAllRoles(refreshToken: String){
      print("vi kører getAllRoles \(refreshToken)")
  
      let urlPath = "http://keebintest-pagh.rhcloud.com/api/users/allroles/"
      let url = NSURL(string: urlPath)
      let session = URLSession.shared
      let request = NSMutableURLRequest(url: url as! URL)
  
      request.addValue(refreshToken, forHTTPHeaderField: "refreshToken")
      request.httpMethod = "GET"
  
  
  
      let task = session.dataTask(with: request as URLRequest, completionHandler: {data, response, error -&gt; Void in
          print("Task completed \(data) and response is xxxx")
  
          let responseString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
          print("responseString = \(responseString!)")
  
  
  
          //            Her laver vi data om til en dictionary
          //            let s = (try! JSONSerialization.jsonObject(with: data!, options: .mutableContainers)) as! String
          //            print("det virkede?")
          //            print(s)
  
          //            var json: Array&lt;String&gt;!
          //            do {
          //                json = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions()) as? Array
          //            } catch {
          //                print(error)
          //            }
          //
          //            print("her er mit json \(json[0])")
  
  
  
  
  
  
      })
      task.resume()
  }
  </code></pre>
  
  <p>This is what my console log looks like:</p>
  
  <pre><code>Task completed Optional(56 bytes) and response is xxxx
  responseString = [{"id":1,"roleName":"Admin"},{"id":2,"roleName":"User"}]
  here is my json {
      id = 2;
      roleName = User;
  }
  </code></pre>
  
  <p>So obviously I get my data, and it is in an array which I can access. However I can't figure out how to create jsonObjects from each of those in the array. Could someone help?</p>
  
  <p>Thanks in advance!</p>