Skip to content

Instantly share code, notes, and snippets.

@ts95
Created October 21, 2017 07:15
Show Gist options
  • Save ts95/f1ac786a2fdd074b96baf36d45f355dc to your computer and use it in GitHub Desktop.
Save ts95/f1ac786a2fdd074b96baf36d45f355dc to your computer and use it in GitHub Desktop.
JSON Decoding Example
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