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.

Title: Make collections.deque json serializable
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: duplicate
Dependencies: Superseder: collections.deque should ship with a stdlib json serializer
View: 20774
Assigned To: Nosy List: rhettinger, serhiy.storchaka, tarek
Priority: normal Keywords:

Created on 2017-02-27 10:21 by tarek, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg288629 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2017-02-27 10:21
collections.deque could be serialized in JSON as a simple array.

The only thing we can lose in the process is the maxlen value, but I think it's a decent behaviour to ignore it when encoding and to set it to None when decoding.
msg288630 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-02-27 10:34
+1 This isn't really different that how we handle tuples and I can see that it would be useful to be able to dump a deque into JSON.  I concur that it is reasonable to ignore maxlen because that is primarily a convenience feature (auto-popping on overflow) rather than something that is intrinsic to the semantics of data itself.
msg288635 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-02-27 11:08
This is a duplicate of issue20774.
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73849
2017-02-27 11:08:31serhiy.storchakasetstatus: open -> closed

superseder: collections.deque should ship with a stdlib json serializer

nosy: + serhiy.storchaka
messages: + msg288635
resolution: duplicate
stage: needs patch -> resolved
2017-02-27 10:34:48rhettingersettype: behavior
messages: + msg288630
stage: needs patch
2017-02-27 10:21:30tarekcreate