Change by My-Tien Nguyen :
--
nosy: My-Tien Nguyen
priority: normal
severity: normal
status: open
title: json dump silently converts int keys to string
___
Python tracker
<https://bugs.python.org/issue34
New submission from My-Tien Nguyen :
When int keys are silently converted to string on json serialization, the user
needs to remember to convert it back to int on loading.
I think that a warning should be shown at least.
In my case I serialize a dict to json with int keys, later load it back
My-Tien Nguyen added the comment:
I don’t think, “other languages do that too” is a good argument here. This
would apply if behaving differently would break user expectation. But here we
would do nothing more than explicitly inform the user of a relevant operation.
If they already expected
My-Tien Nguyen added the comment:
Sure, I can do that, but wanted to propose this regardless. I guess this is a
disagreement on a language design level.
As a proponent of strong typing I wouldn’t have allowed non-string keys in the
first place, and if they are allowed I would warn about
Change by My-Tien Nguyen :
--
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue34972>
___
___
Python-bugs-list mailing list
Unsubscrib