source:
framspy/evolalg/json_encoders.py
@
1329
Last change on this file since 1329 was 1190, checked in by , 2 years ago | |
---|---|
File size: 284 bytes |
Line | |
---|---|
1 | import json |
2 | |
3 | import numpy as np |
4 | |
5 | |
6 | class Encoder(json.JSONEncoder): |
7 | def default(self, obj): |
8 | if isinstance(obj, np.ndarray): |
9 | return obj.tolist() |
10 | if isinstance(obj, np.integer): |
11 | return int(obj) |
12 | return super(Encoder, self).default(obj) |
Note: See TracBrowser
for help on using the repository browser.