The bundle package has bundle() and unbundle() for marshalling and unmarshalling of model-based objects, cf. https://github.com/rstudio/bundle/tree/main/R. Implementing marshal() and unmarshal() S3 methods for those will be a good case study and add more test cases.
/ht @dfalbel /cc @simonpcouch @juliasilge