Skip to content

Commit

Permalink
add NumpyEncoder attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
briangu committed Dec 14, 2023
1 parent 2064ba6 commit c93b927
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions klongpy/ws/sys_fn_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class KGRemoteCloseConnectionException(KlongException):


class NumpyEncoder(json.JSONEncoder):
"""
We need to translate NumPy objects into lists as needed:
https://stackoverflow.com/questions/26646362/numpy-array-is-not-json-serializable
"""
def default(self, obj):
if isinstance(obj, np.ndarray):
return obj.tolist()
Expand Down

0 comments on commit c93b927

Please sign in to comment.