-
-
Save jarsen/8f574d75ee86c5b8b56039bfe5eb432a to your computer and use it in GitHub Desktop.
Unmarshaling
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
| struct User: Unmarshaling { | |
| var id: Int | |
| var name: String | |
| var email: String | |
| init(object: MarshaledObject) throws { | |
| id = try object.value(for: "id") | |
| name = try object.value(for: "name") | |
| email = try object.value(for: "email") | |
| } | |
| } | |
| let users: [User] = try json.value(for: "users") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment