Like encoding/gob, but without the stream requirements.