Typeclass based deserializer