diff --git a/python/polycube_encoder.py b/python/polycube_encoder.py new file mode 100644 index 0000000..ef390ef --- /dev/null +++ b/python/polycube_encoder.py @@ -0,0 +1,9 @@ +from json import JSONEncoder +from typing import Any +from polycube import PolyCube + +class PolyCubeEncdoder(JSONEncoder): + def default(self, o: Any) -> Any: + if isinstance(o, PolyCube): + return list(o.cubes) + return super().default(o)