Issue 31155: Encode set, frozenset, bytearray, and iterators as json arrays (original ) (raw )Created on 2017-08-09 09:23 by javenoneal , last changed 2022-04-11 14:58 by admin . This issue is now closed .
Pull Requests
URL
Status
Linked
Edit
PR 3034
closed
javenoneal,2017-08-09 09:23
Messages (4)
msg299981 - (view)
Author: Javen O'Neal (javenoneal) *
Date: 2017-08-09 09:23
Currently json.dump, json.dumps, and json.JSONEncoder do not support writing iterator objects. Users can choose to pass the iterator to a tuple and write that as a json array, but this is wasteful if the iterator is large, requiring a large amount of memory to be temporarily allocated for the tuple prior to json encoding. The json module also does not support writing sets, frozensets, or bytearrays.
msg315782 - (view)
Author: Ori Avtalion (salty-horse) *
Date: 2018-04-26 07:48
If sets are to be supported, then so should dictionary views. Please also consider the range type.
msg315789 - (view)
Author: Raymond Hettinger (rhettinger) *
Date: 2018-04-26 12:21
There is some virtue to the current design. Having a user explicitly cast to a list will avoid unintentional conversions.
msg339597 - (view)
Author: Inada Naoki (methane) *
Date: 2019-04-08 07:52
I concur with Raymond. If you really need this feature, please discuss on python-dev ML.
History
Date
User
Action
Args
2022-04-11 14:58:49
admin
set
github: 75338
2021-10-07 08:11:02
sedrubal
set
nosy: + sedrubal
2019-04-08 07:52:33
methane
set
status: open -> closednosy: + methane messages: + resolution: rejectedstage: resolved
2018-04-26 12:21:11
rhettinger
set
nosy: + rhettinger messages: +
2018-04-26 07:48:09
salty-horse
set
nosy: + salty-horse messages: +
2017-08-09 19:15:47
rhettinger
set
assignee: bob.ippolito nosy: + bob.ippolito
2017-08-09 09:23:16
javenoneal
create