Skip to content

Instantly share code, notes, and snippets.

@LucasMW
Last active August 2, 2017 18:07
Show Gist options
  • Save LucasMW/e24c7d0508b1d91a5307a147967588b9 to your computer and use it in GitHub Desktop.
Save LucasMW/e24c7d0508b1d91a5307a147967588b9 to your computer and use it in GitHub Desktop.
let url = URL(string: "https//api.meusite.org")
do {
let data = try Data(contentsOf: url!)
let json = try JSONSerialization.jsonObject(with: data, options:.allowFragments)
let array = json as! [String: Any]
for (key,data) in array {
let dict = data as! [String : Any]
//print(key)
//print(data)
}
//print(json)
}
catch {
print("Couldn't fetch\nError:\(error)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment