Created
October 21, 2017 07:15
-
-
Save ts95/f1ac786a2fdd074b96baf36d45f355dc to your computer and use it in GitHub Desktop.
JSON Decoding Example
This file contains hidden or 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
let json = """ | |
{ | |
"isbn": "95-0443-843-0", | |
"title": "Do Androids Dream of Electric Sheep?", | |
"authors": ["Philip K. Dick"], | |
"year": 1968, | |
"country": "United States" | |
} | |
""".data(using: .utf8)! | |
let book = JSONDecoder.decode(Book.self, from: json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment