Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5200a7c commit 76c567eCopy full SHA for 76c567e
1 file changed
Lib/json/__init__.py
@@ -76,7 +76,7 @@
76
>>> def encode_complex(obj):
77
... if isinstance(obj, complex):
78
... return [obj.real, obj.imag]
79
- ... raise TypeError(repr(o) + " is not JSON serializable")
+ ... raise TypeError(repr(obj) + " is not JSON serializable")
80
...
81
>>> json.dumps(2 + 1j, default=encode_complex)
82
'[2.0, 1.0]'
0 commit comments