[issue39196] json fails to encode dictionary view types

2020-01-03 Thread Inada Naoki


Inada Naoki  added the comment:

If we support more types by default, user can not customize serialization of 
the type using `default` option.
That's why we don't accept "any iterable" but only list and tuple.

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39196] json fails to encode dictionary view types

2020-01-03 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39196] json fails to encode dictionary view types

2020-01-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

To handle non-standard types you can implement the default() method in the 
subclass of json.JSONEncoder 
(https://docs.python.org/3/library/json.html#json.JSONEncoder.default) or pass 
the corresponding argument to json.JSONEncoder() or json.dumps().

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39196] json fails to encode dictionary view types

2020-01-02 Thread Joe Gordon


New submission from Joe Gordon :

Python 3 fails to encode dictionary view objects. Assuming this is an expected 
behavior, what is the thinking behind it? I was unable to find any 
documentation around this.

> import json; json.dumps({}.values())
"TypeError: Object of type dict_values is not JSON serializable"

--
components: Library (Lib)
messages: 359212
nosy: jogo
priority: normal
severity: normal
status: open
title: json fails to encode dictionary view types
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com