-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugsomething brokensomething broken
Description
The default JSON serializer is not able to serialize Decimal objects.
Exact traceback from a use case:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/plotly/plotly/plotly.py", line 241, in plot
res = _send_to_plotly(figure, **plot_options)
File "/Library/Python/2.7/site-packages/plotly/plotly/plotly.py", line 1374, in _send_to_plotly
cls=utils.PlotlyJSONEncoder)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 250, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/Library/Python/2.7/site-packages/plotly/utils.py", line 145, in encode
encoded_o = super(PlotlyJSONEncoder, self).encode(o)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/Library/Python/2.7/site-packages/plotly/utils.py", line 211, in default
return json.JSONEncoder.default(self, obj)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: Decimal('-94.6285553000') is not JSON serializable
Metadata
Metadata
Assignees
Labels
bugsomething brokensomething broken