Deserialize with reflection instead of large switch statement

Fixes #1