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.

Author Juozas.Masiulis
Recipients Juozas.Masiulis
Date 2018-10-08.14:11:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539007886.12.0.545547206417.issue34933@psf.upfronthosting.co.za>
In-reply-to
Content
currently python behaves like this:
>>> import json
>>> a={'a': '//a[@asdf="asdf"]'}
>>> json.dumps(a)
'{"a": "//a[@asdf=\\"asdf\\"]"}'

this behaviour is incorrect.

the resulting string should be '{"a": "//a[@asdf=\"asdf\"]"}'

The difference is that double quotes inside double quotes are escaped twice instead of once. 

compare it to behaviour in javascript:

> var a = {'a': '//a[@asdf="asdf"]'}
undefined

JSON.stringify(a)
"{"a":"//a[@asdf=\"asdf\"]"}"
History
Date User Action Args
2018-10-08 14:11:26Juozas.Masiulissetrecipients: + Juozas.Masiulis
2018-10-08 14:11:26Juozas.Masiulissetmessageid: <1539007886.12.0.545547206417.issue34933@psf.upfronthosting.co.za>
2018-10-08 14:11:26Juozas.Masiulislinkissue34933 messages
2018-10-08 14:11:26Juozas.Masiuliscreate