to/from json methods
Closed this issue · 0 comments
joe-pierce commented
We want to include methods to_json
and from_json
on all of the main classes and unit classes. These methods will produce a 'lossless' JSON-formatted string containing all the data from the associated python object in a way that it can be rebuilt identically from the same JSON string.
For example we would expect that:
dat= DAT("some_file.dat")
json_data = dat.to_json()
dat == DAT.from_json(json_data)
These methods should be available on all FMFile and Unit base classes so they can be shared across all children of those. The JSON structure should match the python object structure identically if possible but may need some specific adjustments.