Message246776
Currently the json lib only logs the string representation of the variable, which does not always include type information.
I recently ran into a difficult to debug issue with code similar to the following:
```
import json
import numpy as np
d = {'data': np.int16(5)}
json.dumps(d)
```
which produces the following error:
```
TypeError: 5 is not JSON serializable
```
It took us quite a while to determine that `5` was actually of type `np.int` instead of the native type.
A cursory glance at StackOverflow suggests that I'm not alone in running into this issue: http://stackoverflow.com/questions/10872604/json-dump-throwing-typeerror-is-not-json-serializable-on-seemingly-vali
I'd like to consider modifying the error message to be more similar to the following:
```
TypeError: 5 of type `numpy.int16` is not JSON serializable
``` |
|
Date |
User |
Action |
Args |
2015-07-15 20:49:32 | Madison May | set | recipients:
+ Madison May |
2015-07-15 20:49:32 | Madison May | set | messageid: <1436993372.93.0.482029912936.issue24641@psf.upfronthosting.co.za> |
2015-07-15 20:49:32 | Madison May | link | issue24641 messages |
2015-07-15 20:49:32 | Madison May | create | |
|