Specifically to GHPython, I tend to structure RhinoCommon geometry data and more primitive types (floats, integers, strings, booleans) into a dictionary. And then pickle/unpickle (i.e. serialise) that to/from file using the standard pickle
module:
https://ironpython-test.readthedocs.io/en/latest/library/pickle.html
Note that there’s also the cpickle
standard module, and that not all data types will pickle. If you’re only interested in primitive types, I’d advice to use the standard json
module instead, making the data file universal.