From: Thomas Fillon Date: Tue, 29 Apr 2014 08:12:30 +0000 (+0200) Subject: Cherry-pick 11807d66ff7483031b325 X-Git-Tag: 0.5.5~1^2~39 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d2c4c1c77cd8a8409c530c52dcdd99fb628ce13f;p=timeside.git Cherry-pick 11807d66ff7483031b325 --- diff --git a/timeside/analyzer/core.py b/timeside/analyzer/core.py index 65f0247..c7846be 100644 --- a/timeside/analyzer/core.py +++ b/timeside/analyzer/core.py @@ -924,10 +924,12 @@ class AnalyzerResultContainer(dict): if isinstance(obj, numpy.ndarray): return {'numpyArray': obj.tolist(), 'dtype': obj.dtype.__str__()} + elif isinstance(obj, numpy.generic): + return numpy.asscalar(obj) else: - return {'value': obj.tolist(), - 'dtype': obj.dtype.__str__()} - raise TypeError(repr(obj) + " is not JSON serializable") + print obj + print type(obj) + raise TypeError(repr(obj) + " is not JSON serializable") json_str = json.dumps([res.as_dict() for res in self.values()], default=NumpyArrayEncoder)