taschini / pyinterval

PyInterval — Interval arithmetic in Python
http://pyinterval.readthedocs.io
Other
83 stars 25 forks source link

Make it JSON serializable #23

Closed yuxincs closed 4 years ago

yuxincs commented 6 years ago

It would be nice if the Interval class is JSON-serializable to store it to files/strings etc.

barryam3 commented 4 years ago

It looks like it is.

>>> import interval
>>> import json
>>> json.dumps(interval.interval[1,2])
'[[1.0, 2.0]]'
yuxincs commented 4 years ago

It looks like it is.

>>> import interval
>>> import json
>>> json.dumps(interval.interval[1,2])
'[[1.0, 2.0]]'

Just tested it again and it seems like it is. I forgot why I opened this issue in the first place.

Anyway, closing this issue now. Thanks for the reply :)