User specified serialization strategy.

JSON by default, but the user can specify a strategy of their choosing
by providing `serialize` and `deserialize` functions.

Closes #230.