How to parse JSON when there is no key but only an Integer / String value?

Viewed 962

How can I parse this JSON file ? My code is working when both keys and values are available .

My code so far :

let url = URL(string: "http://uhunt.felix-halim.net/api/uname2uid/felix_halim")
let task = URLSession.shared.dataTask(with: url!, completionHandler: {
    (data, response, error) in
    print("Task Started")

    if error != nil {
        print("In Error!")
    } else {
        if let content = data {
            do {
                let myJSON =
                    try JSONSerialization.jsonObject(with: content, options: .mutableContainers) as AnyObject
                print(myJSON)
            } catch {
                print("In Catch!")
            }
        }
    }
})
task.resume()
print("Finished")
2 Answers
Related