A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-February/138408.html below:

[Python-Dev] Enum is really serializable using json?

[Python-Dev] Enum is really serializable using json?Benjamin Peterson benjamin at python.org
Sat Feb 21 19:50:41 CET 2015
On Sat, Feb 21, 2015, at 13:48, Facundo Batista wrote:
> We have this issue closed as resolved:
> 
>   http://bugs.python.org/issue18264
> 
> It's called "enum.IntEnum is not compatible with JSON serialisation",
> and it looks that after a long conversation they added proper support
> for it in Py3.4.
> 
> However, this is still failing:
> 
> Python 3.4.2 (default, Oct  8 2014, 13:18:07)
> [GCC 4.9.1] on linux
> >>> import enum, json
> >>> Foo = enum.Enum('Foo', 'bar baz')
> >>> json.dumps(Foo.bar)
> Traceback (most recent call last):
> ...
> TypeError: <Foo.bar: 1> is not JSON serializable
> 
> Am I failing to understand the bug tracker saying the patch was
> applied for Py3.4?

As the issue title suggests, IntEnum but not Enum supports JSON
serialization.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4