Skip to content

Instantly share code, notes, and snippets.

@kittinunf
Created September 27, 2015 16:50
Show Gist options
  • Save kittinunf/34ed8f6e3e8645c40e2f to your computer and use it in GitHub Desktop.
Save kittinunf/34ed8f6e3e8645c40e2f to your computer and use it in GitHub Desktop.
class User(val id: Int, val name: String, val age: Int, val email: String) {
class Deserializer : Deserializable<User> {
override val deserializer: (JSON) -> Result<User, Exception> = { json ->
::User.create.
map(json at "id").
apply(json at "name").
apply(json at "age").
apply(json at "email")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment