[issue40153] json dump with repeated key

2020-08-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This module has been heavily used in the real world and we have no evidence 
that there is an actual problem to be solved.  Marking this as closed.  If a 
real world issue does arise, feel free to reopen and we can consider extending 
the API to have a validation step.

--
resolution:  -> not a bug
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



[issue40153] json dump with repeated key

2020-08-30 Thread Facundo Batista


Facundo Batista  added the comment:

The balance here is allow an invalid JSON to be created (but documenting that 
on some situations that will happen), or sticking to always produce valid 
JSONs, but with a hit in performance (which we don't know so far if it's big or 
small).

--

___
Python tracker 

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



[issue40153] json dump with repeated key

2020-04-07 Thread Facundo Batista


Facundo Batista  added the comment:

It's a theoretical issue, I didn't hit it myself.

--

___
Python tracker 

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



[issue40153] json dump with repeated key

2020-04-07 Thread Vedran Čačić

Vedran Čačić  added the comment:

JSON is JavaScript Object Notation, that is, a notation for JS Objects. Python 
dicts are much more general than that (not only in keys, but in values too: 
JSON keys must be strings, and values must be Strings, Numbers, Booleans, 
Arrays, (JS) Objects, or nulls -- both are restricted compared to Python 
dicts). There is really no reason to expect full embedding.

--
nosy: +veky

___
Python tracker 

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



[issue40153] json dump with repeated key

2020-04-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Has this been a problem in practice, or just a theoretical issue?

To make this raise an exception, the JSON encoder would have to add one extra 
test per key.

I think we should just document the possibility.

--
nosy: +rhettinger

___
Python tracker 

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



[issue40153] json dump with repeated key

2020-04-02 Thread Facundo Batista


New submission from Facundo Batista :

As stated in docs [0], JSON structures must not have duplicated keys.

>>> json.dumps({1:2, "1":3})
'{"1": 2, "1": 3}'

This is related to https://bugs.python.org/issue34972 . 



[0] "The RFC specifies that the names within a JSON object should be unique, 
..." https://docs.python.org/3/library/json.html#repeated-names-within-an-object

--
messages: 365581
nosy: facundobatista
priority: normal
severity: normal
status: open
title: json dump with repeated key
versions: 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