Make Value encodable

This is also needed in preparation for msgpack-rpc.