Skip to content

Commit

Permalink
fix: adding loopjson encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Jun 8, 2022
1 parent 93b3458 commit ec1b84e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LoopStructural/utils/json_encoder.py
Original file line number Diff line number Diff line change
@@ -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__()

0 comments on commit ec1b84e

Please sign in to comment.