Parsing JSON Array of Dictionaries

Viewed 10383

I am a newbie to parsing JSON and using Restful API. Whatevs, i have been looking a lot for this issue and I found lots of. But I couldn't figure it out.

JSON that I want to parse is: http://jsonplaceholder.typicode.com/users

guard let url = URL(string: "http://jsonplaceholder.typicode.com/users/") else {return}
    let session = URLSession.shared

    session.dataTask(with: url) { (data, response, error) in
        if error != nil {
            print(error ?? "")
        }
        if data != nil {
            do{
                let json = try JSONSerialization.jsonObject(with: data!, options: .mutableLeaves)

                guard let idk = json as? [Dictionary<String, Any>] else {return}

               print(idk)
            }
            catch{
                print(error)
            }
        }
    }.resume()

I came untill here and I can't move on. For example I'd like to reach id, name and username but I dont know what to do anymore. And Im wonder what if I'd like to dive into the dictionary of Adress ?

2 Answers
Related