diff --git a/LoopStructural/utils/json_encoder.py b/LoopStructural/utils/json_encoder.py new file mode 100644 index 000000000..e6ce90cad --- /dev/null +++ b/LoopStructural/utils/json_encoder.py @@ -0,0 +1,17 @@ +import json +class LoopJSONEncoder(json.JSONEncoder): + def default(self, obj): + """All jsonable loop objects should have a tojson method + + Parameters + ---------- + obj : LoopStructuralObject + An object from loopstructural + + Returns + ------- + str + string representing the json encoding + """ + return obj.__tojson__() + \ No newline at end of file