Last active
March 3, 2019 11:36
-
-
Save Prate-k/5e98d3e9284545e0df9385f74733f54e to your computer and use it in GitHub Desktop.
Accessing JSON values with the known keys from JSON response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if let query = json["query"] as? [String:Any] { | |
if let pages = query["pages"] as? [String:Any] { | |
if let page = pages["30984"] as? [String:Any] { | |
if let revisions = page["revisions"] as? [[String:Any]] { | |
if let element = revisions[0] as? [String:Any] { | |
if let htmlData = element["*"] as? String { | |
print(htmlData) | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment