This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jason Hihn
Recipients Jason Hihn
Date 2017-11-09.19:05:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510254323.87.0.213398074469.issue31994@psf.upfronthosting.co.za>
In-reply-to
Content
Given this traceback:
  File "/usr/local/Cellar/python/2.7.13/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: 7.0374198 is not JSON serializable

It would actually be better to have the error reported as type(o)+ " is not JSON serializable."  because at first glance, 7.0374198 *is* serializable. In this specific case, the issue can be fixed by attempting to serialize float(o), because it is a ndarray. Maybe there's a better way to do numpy types or some kind of automatic conversion but for now, this is only a request to alter the message, I'd hope to something like:

repr(o) + " of type " + type(o) + " is not JSON serializable"

It's it's really more about the type rather than the value being serialized.
History
Date User Action Args
2017-11-09 19:05:23Jason Hihnsetrecipients: + Jason Hihn
2017-11-09 19:05:23Jason Hihnsetmessageid: <1510254323.87.0.213398074469.issue31994@psf.upfronthosting.co.za>
2017-11-09 19:05:23Jason Hihnlinkissue31994 messages
2017-11-09 19:05:23Jason Hihncreate